about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-12-19 17:42:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-12-19 17:42:09 +0000
commitc8d07027c89d36a5a3981196a19d48a9286127a8 (patch)
tree47d284216cd29b7f72abe99db4c197b80a6cf4ab
parenta9b59ef8ecf6a5a2829448ed48a9c6135b9b15c6 (diff)
downloadzsh-c8d07027c89d36a5a3981196a19d48a9286127a8.tar.gz
zsh-c8d07027c89d36a5a3981196a19d48a9286127a8.tar.xz
zsh-c8d07027c89d36a5a3981196a19d48a9286127a8.zip
28537: fix word splitting on "((" when it was nested subshells rather than
arithmetic
-rw-r--r--ChangeLog8
-rw-r--r--Src/lex.c5
-rw-r--r--Test/D04parameter.ztst14
3 files changed, 26 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c899ac60..6ba2f041b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-19  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 28537: Src/lex.c, Test/D04parameter.ztst: word splitting on
+	'((' in command position that turned into nested subshell
+	commands was broken.
+
 2010-12-18  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 27862 (belatedly): Completion/X/Utility/_x_arguments: handle
@@ -13997,5 +14003,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5159 $
+* $Revision: 1.5160 $
 *****************************************************
diff --git a/Src/lex.c b/Src/lex.c
index 3d70c5bbf..2988b41cb 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -885,6 +885,11 @@ gettok(void)
 		    return DINPAR;
 
 		case 0:
+		    /*
+		     * Not math, so we don't return the contents
+		     * as a string in this case.
+		     */
+		    tokstr = NULL;
 		    return INPAR;
 
 		default:
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 8ce68c317..8ba08b29c 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -393,6 +393,7 @@
     'foo=(1 2 3)'
     '(( 3 + 1 == 8 / 2 ))'
     'for (( i = 1 ; i < 10 ; i++ ))'
+    '((0.25542 * 60) - 15)*60'
   )
   for string in $strings; do
     array=(${(z)string})
@@ -416,6 +417,19 @@
 >4:i < 10 ;:
 >5:i++ :
 >6:)):
+# This one needs resolving between a math expression and
+# a command, which causes interesting effects internally.
+>1:(:
+>2:(:
+>3:0.25542:
+>4:*:
+>5:60:
+>6:):
+>7:-:
+>8:15:
+>9:):
+>10:*60:
+
 
   line=$'A line with # someone\'s comment\nanother line # (1 more\nanother one'
   print "*** Normal ***"