zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] var=$* and var=$@ create array with SHWORDSPLIT and null or unset IFS
Date: Mon, 20 Feb 2017 13:20:58 -0800	[thread overview]
Message-ID: <170220132058.ZM27903@torch.brasslantern.com> (raw)
In-Reply-To: <170220105837.ZM12210@torch.brasslantern.com>

On Feb 20, 10:58am, Bart Schaefer wrote:
}
} >--- null IFS, native splitting ---
} >> var=$@
} >[one two three four]
} >> var=$*
} >[onetwo threefour]
} >> var="$@"
} >[one two three four]
} >> var="$*"
} >[onetwo threefour]
} 
} Joining the array for assignment is forced by prefork() passing
} PREFORK_SINGLE down to paramsubst().  Joining is supposed to be done on
} the first character of $IFS in this case.  When IFS is null (as opposed
} to unset), this causes both $@ and $* to join on empty string.
} 
} Where is the space supposed to come from when joining $@ here?

Thanks to Chet Ramey for pointing me at
http://austingroupbugs.net/view.php?id=888

Which says (very last block of examples) that var=$@ and var="$@" and
a whole slew of their variations, have unspecified behavior.

Consequently I'm going to take the position that zsh is allowed to join
these with empty string rather than pulling a field separator out of
its proverbial hat, and I will tweak 40565 appropriately and commit.


  reply	other threads:[~2017-02-20 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 23:05 Martijn Dekker
2017-02-17  0:07 ` Martijn Dekker
2017-02-17  5:14 ` Bart Schaefer
2017-02-20 18:58   ` Bart Schaefer
2017-02-20 21:20     ` Bart Schaefer [this message]
2017-02-20 22:13       ` Martijn Dekker

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=170220132058.ZM27903@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).