zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: regression in "$*" expansion
Date: Tue, 28 Feb 2012 10:29:00 +0000	[thread overview]
Message-ID: <20120228102900.53d578bb@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20120227202456.GD7566@yahoo.fr>

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


      parent reply	other threads:[~2012-02-28 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 20:24 Stephane Chazelas
2012-02-28  9:28 ` Jérémie Roquet
2012-02-28 10:29 ` Peter Stephenson [this message]

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=20120228102900.53d578bb@pwslap01u.europe.root.pri \
    --to=peter.stephenson@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).