about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2017-04-23 17:06:26 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2017-04-23 17:06:26 +0100
commit68466f327e15579939ff359464c42b2b966a7825 (patch)
treee5444ba5e0398cfafa29a70ca4c43438a3169aea
parent3c78f14d5cfe98cb567cced9cfe283cb890155ef (diff)
downloadzsh-68466f327e15579939ff359464c42b2b966a7825.tar.gz
zsh-68466f327e15579939ff359464c42b2b966a7825.tar.xz
zsh-68466f327e15579939ff359464c42b2b966a7825.zip
40995: Don't disable alias expansion when finding command substitution limits
This is needed in some unusual cases in order to identify the exit
condition without encountering a parse error.
-rw-r--r--ChangeLog6
-rw-r--r--Src/lex.c3
-rw-r--r--Test/D08cmdsubst.ztst10
3 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 00aebbb83..cef83e09c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-23  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 40995: Src/lex.c, Test/D08cmdsubst.ztst: we need to expand
+	aliases when identifiying the end of a command substitution as
+	sometimes we can hit a parse error before.
+
 2017-04-23  Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
 
 	* 40994: Src/utils.c: unmeta_one() need not count Meta
diff --git a/Src/lex.c b/Src/lex.c
index 59e9d1472..b2d9b3f42 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -2060,9 +2060,7 @@ skipcomm(void)
     int new_lexstop, new_lex_add_raw;
     int save_infor = infor;
     struct lexbufstate new_lexbuf;
-    int noalias = noaliases;
 
-    noaliases = 1;
     infor = 0;
     cmdpush(CS_CMDSUBST);
     SETPARBEGIN
@@ -2189,7 +2187,6 @@ skipcomm(void)
 	SETPAREND
     cmdpop();
     infor = save_infor;
-    noaliases = noalias;
 
     return lexstop;
 #endif
diff --git a/Test/D08cmdsubst.ztst b/Test/D08cmdsubst.ztst
index 362537349..4e0759e35 100644
--- a/Test/D08cmdsubst.ztst
+++ b/Test/D08cmdsubst.ztst
@@ -167,3 +167,13 @@
   empty=$() && print "'$empty'"
 0:Empty $() is a valid assignment
 >''
+
+  (
+    setopt ignoreclosebraces
+    alias OPEN='{' CLOSE='};'
+    eval '{ OPEN print hi; CLOSE }
+    var=$({ OPEN print bye; CLOSE}) && print $var'
+  )
+0:Alias expansion needed in parsing substituions
+>hi
+>bye