From: Peter Stephenson <pws@csr.com>
To: zsh-workers@zsh.org
Subject: Re: Is this a bug? Why not?
Date: Fri, 9 Apr 2010 15:37:54 +0100 [thread overview]
Message-ID: <20100409153754.76d0f6a6@news01> (raw)
In-Reply-To: <100401155118.ZM11873@torch.brasslantern.com>
On Thu, 01 Apr 2010 15:51:18 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Apr 1, 2:57pm, Phil Pennock wrote:
> } Subject: Re: Is this a bug? Why not?
> }
> } > E.g., why doesn't the following cause $foo to be quoted?
> } >
> } > schaefer[516] ARGV0=sh Src/zsh
> } > $ foo="???"
> } > $ print ${foo+"$foo"}
> } > Doc Etc Src
> } > $
> } >
> } > It works in bash.
>
> } Is this use-case important enough to warrant yet another option?
>
> Normally I'd be a stickler for not changing existing behavior, but in
> this case it looks so obviously like a bug in the way glob_subst is
> implemented that I'm not sure a new option is needed.
I think that's correct. It might be as simple as this.
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.102
diff -p -u -r1.102 subst.c
--- Src/subst.c 27 Mar 2010 19:04:36 -0000 1.102
+++ Src/subst.c 9 Apr 2010 14:34:26 -0000
@@ -2417,7 +2417,7 @@ paramsubst(LinkList l, LinkNode n, char
multsub(&val, spbreak && !aspar, (aspar ? NULL : &aval), &isarr, NULL);
opts[SHWORDSPLIT] = ws;
copied = 1;
- spbreak = 0;
+ spbreak = globsubst = 0;
}
break;
case ':':
Index: Test/D04parameter.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v
retrieving revision 1.40
diff -p -u -r1.40 D04parameter.ztst
--- Test/D04parameter.ztst 15 Mar 2010 10:19:38 -0000 1.40
+++ Test/D04parameter.ztst 9 Apr 2010 14:34:26 -0000
@@ -221,6 +221,16 @@
>\\foo matched by \\*\\
>a\\b not matched by \\*\\
+ (
+ setopt globsubst
+ foo="boring*"
+ print ${foo+$foo}
+ print ${foo+"$foo"}
+ )
+0:globsubst together with nested quoted expansion
+>boringfile
+>boring*
+
print -l "${$(print one word)}" "${=$(print two words)}"
0:splitting of $(...) inside ${...}
>one word
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
next prev parent reply other threads:[~2010-04-09 15:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 5:46 Bart Schaefer
2010-03-31 6:06 ` Phil Pennock
2010-03-31 15:11 ` Bart Schaefer
2010-04-01 8:26 ` Phil Pennock
2010-04-01 14:36 ` Bart Schaefer
2010-04-01 21:57 ` Phil Pennock
2010-04-01 22:51 ` Bart Schaefer
2010-04-09 14:37 ` Peter Stephenson [this message]
2010-04-17 13:06 ` Mikael Magnusson
2010-04-18 19:11 ` Peter Stephenson
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=20100409153754.76d0f6a6@news01 \
--to=pws@csr.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).