From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: [BUG] (z)-flag interrupts if $() in input
Date: Sun, 30 Oct 2016 17:09:49 +0000 [thread overview]
Message-ID: <20161030170949.612551cf@ntlworld.com> (raw)
In-Reply-To: <20161030152525.GA12137@fujitsu.shahaf.local2>
On Sun, 30 Oct 2016 15:25:25 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Should the command
> .
> % echo foo $() bar
> .
> print "foo bar\n" or return a parse error?
>
That's obviously a bug. The fix is easy, although I don't know why the
case of end of input in a normal input sequence, just above, needs to be
different.
pws
diff --git a/Src/parse.c b/Src/parse.c
index 24b8cd9..50a0d5f 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -594,7 +594,7 @@ par_event(int endtok)
if (tok == ENDINPUT)
return 0;
if (tok == endtok)
- return 0;
+ return 1;
p = ecadd(0);
diff --git a/Test/D08cmdsubst.ztst b/Test/D08cmdsubst.ztst
index 89e7259..3625373 100644
--- a/Test/D08cmdsubst.ztst
+++ b/Test/D08cmdsubst.ztst
@@ -153,3 +153,17 @@
eval 'foo echo this just works, OK\?)'
0:backtracking within command string parsing with alias still pending
>this just works, OK?
+
+ (
+ set errexit
+ show_nargs() { print $#; }
+ print a $() b
+ print c "$()" d
+ )
+0:Empty $() is a valid empty substitution.
+>a b
+>c d
+
+ empty=$() && print "'$empty'"
+0:Empty $() is a valid assignment
+>''
next prev parent reply other threads:[~2016-10-30 17:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-30 6:33 Sebastian Gniazdowski
2016-10-30 15:25 ` Daniel Shahaf
2016-10-30 17:09 ` Peter Stephenson [this message]
2016-10-30 18:04 ` Bart Schaefer
2016-10-30 20:14 ` Bart Schaefer
2016-11-03 10:23 ` Peter Stephenson
2016-10-30 17:55 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161030170949.612551cf@ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).