summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/lex.c25
2 files changed, 23 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d1e7aa713..fc9ceeddf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-23  Peter Stephenson  <pws@csr.com>
+
+	* 23126, modified: Src/lex.c: errors when deciding between
+	$(( and $( were not handled properly and in particular caused
+	problems in history expansion in zle.  The code is a little
+	obscure; added a comment about this.
+
 2007-01-22  Peter Stephenson  <pws@csr.com>
 
 	* 23122: Src/sort.c: bug with some strings with embedded nulls and
diff --git a/Src/lex.c b/Src/lex.c
index 095d58150..7748bedad 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -542,14 +542,14 @@ cmd_or_math(int cs_type)
     c = dquote_parse(')', 0);
     cmdpop();
     *bptr = '\0';
-    if (!c) {
-	c = hgetc();
-	if (c == ')')
-	    return 1;
-	hungetc(c);
-	lexstop = 0;
-	c = ')';
-    }
+    if (c)
+	return 1;
+    c = hgetc();
+    if (c == ')')
+	return 1;
+    hungetc(c);
+    lexstop = 0;
+    c = ')';
     hungetc(c);
     lexstop = 0;
     while (len > oldlen) {
@@ -1436,8 +1436,15 @@ dquote_parse(char endchar, int sub)
 	cmdpop();
     if (lexstop)
 	err = intick || endchar || err;
-    else if (err == 1)
+    else if (err == 1) {
+	/*
+	 * TODO: as far as I can see, this hack is used in gettokstr()
+	 * to hungetc() a character on an error.  However, I don't
+	 * understand what that actually gets us, and we can't guarantee
+	 * it's a character anyway, because of the previous test.
+	 */
 	err = c;
+    }
     if (zlemath && zlemetacs <= zlemetall + 1 - inbufct)
 	inwhat = IN_MATH;
     return err;