Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Alias expansion inconsistency in $(command substitutions) with IGNORE_CLOSE_BRACES
- X-seq: zsh-workers 40995
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Alias expansion inconsistency in $(command substitutions) with IGNORE_CLOSE_BRACES
- Date: Fri, 21 Apr 2017 20:58:15 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1492804696; bh=jXFWAISe0h/TEnUQoPJoT+6huTqpzC3UIt1Hu//htPo=; h=Date:From:To:Subject:In-Reply-To:References; b=sp10dYinYnLbY1ZJPpXkdO5byHTeaYlycZ7vprvHkdRPO5upgK/gtTwiZZ5ibb/LL er6iYjfwv1O/Xb43tl2IjkDhCAfhGPw1iu0LJEqo7DX5gWc2jJquBwRKOinCaZsrNA Qvm+bauo8heHOChCnDl7SBMqnxmyqZwW36xDVUsIgRDv62OxhzbnVHcb0eJ1WDnuvw hMseoYnHHKCldvJe2DfI7p0rXmrXSRumOUsSFyXFjUdhUi5yVWZxorMKaggoFohU2/ Z8+VF/mRZgfH13IPhGIDcS+CX6JBRklsF00/nsrDrCHFg71ZN+HLTxbK1VkW475MCm txboq+2RxWy6g==
- In-reply-to: <131b162a-b1f8-998c-e5ca-6a161dfef16f@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <131b162a-b1f8-998c-e5ca-6a161dfef16f@inlv.org>
On Sun, 16 Apr 2017 17:07:09 +0100
Martijn Dekker <martijn@xxxxxxxx> wrote:
> If either the IGNORE_CLOSE_BRACES or IGNORE_BRACES option is active,
> there is an inconsistency in alias expansion within command
> substitutions, specifically those of the form $(command).
>
> Given:
>
> % set -o ignoreclosebraces
> % alias OPEN='{' CLOSE='};'
>
> These work fine:
>
> % { OPEN echo hi; CLOSE }
> hi
> % var=`{ OPEN echo hi; CLOSE }` && echo "$var"
> hi
>
> But this does not:
>
> % var=$({ OPEN echo hi; CLOSE }) && echo "$var"
We are too cavalier in our initial parsing to determine where the
command substitution ends.
pws
diff --git a/Src/lex.c b/Src/lex.c
index 59e9d14..b2d9b3f 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 3625373..4e0759e 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author