zsh-workers
 help / color / mirror / code / Atom feed
* regression in "$*" expansion
@ 2012-02-27 20:24 Stephane Chazelas
  2012-02-28  9:28 ` Jérémie Roquet
  2012-02-28 10:29 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Stephane Chazelas @ 2012-02-27 20:24 UTC (permalink / raw)
  To: zsh-workers

$ ARGV0=sh zsh -c 'IFS=; print -rl "$*"' x a b c
a
b
c

(instead of expected "abc").

It's only in sh emulation, and I'm pretty sure it worked
correctly before though I can't verify it now.

~$ zsh --version
zsh 4.3.15 (x86_64-unknown-linux-gnu)

-- 
Stephane



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: regression in "$*" expansion
  2012-02-27 20:24 regression in "$*" expansion Stephane Chazelas
@ 2012-02-28  9:28 ` Jérémie Roquet
  2012-02-28 10:29 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Jérémie Roquet @ 2012-02-28  9:28 UTC (permalink / raw)
  To: Stephane Chazelas; +Cc: zsh-workers

Hi,

2012/2/27 Stephane Chazelas <stephane_chazelas@yahoo.fr>:
> $ ARGV0=sh zsh -c 'IFS=; print -rl "$*"' x a b c
> a
> b
> c
>
> (instead of expected "abc").
>
> It's only in sh emulation, and I'm pretty sure it worked
> correctly before though I can't verify it now.
>
> ~$ zsh --version
> zsh 4.3.15 (x86_64-unknown-linux-gnu)

I get the same output using zsh 4.3.12-dev-1 (which I compiled from
the git repo on the 29th of June) or zsh 4.3.11-dev-4 (which I *think*
I compiled from the git repo on the 24th of May) but I get "abc" using
zsh 4.3.11 (which has been shipped with Ubuntu some times ago).

Best regards,

-- 
Jérémie


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: regression in "$*" expansion
  2012-02-27 20:24 regression in "$*" expansion Stephane Chazelas
  2012-02-28  9:28 ` Jérémie Roquet
@ 2012-02-28 10:29 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2012-02-28 10:29 UTC (permalink / raw)
  To: zsh-workers

On Mon, 27 Feb 2012 20:24:56 +0000
Stephane Chazelas <stephane_chazelas@yahoo.fr> wrote:
> $ ARGV0=sh zsh -c 'IFS=; print -rl "$*"' x a b c
> a
> b
> c
> 
> (instead of expected "abc").

I don't really understand the nojoin flag (in the sense of "I never
really understood string theory") but it shouldn't be doing anything
related to SHWORDSPLIT within quotes, unless we're explicitly using (@)
or $@ which we haven't tested at this point.  So I think the fix is
just this local change.

Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.132
diff -p -u -r1.132 subst.c
--- Src/subst.c	20 Feb 2012 17:50:40 -0000	1.132
+++ Src/subst.c	28 Feb 2012 10:23:11 -0000
@@ -1649,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char 
      * This is one of the things that decides whether multsub
      * will produce an array, but in an extremely indirect fashion.
      */
-    int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) : 0;
+    int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) && !qt : 0;
     /*
      * != 0 means ${...}, otherwise $...  What works without braces
      * is largely a historical artefact (everything works with braces,
Index: Test/D04parameter.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v
retrieving revision 1.62
diff -p -u -r1.62 D04parameter.ztst
--- Test/D04parameter.ztst	22 Feb 2012 15:35:50 -0000	1.62
+++ Test/D04parameter.ztst	28 Feb 2012 10:23:11 -0000
@@ -1475,3 +1475,13 @@
    print ${#foo}
 0:Nularg removed from split empty string
 >0
+
+   (set -- a b c
+    setopt shwordsplit
+    IFS=
+    print -rl "$*"
+    unset IFS
+    print -rl "$*")
+0:Regression test for shwordsplit with null or unset IFS and quoted array
+>abc
+>a b c


-- 
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
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-28 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27 20:24 regression in "$*" expansion Stephane Chazelas
2012-02-28  9:28 ` Jérémie Roquet
2012-02-28 10:29 ` Peter Stephenson

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).