zsh-workers
 help / color / mirror / code / Atom feed
* shwordsplit: final non-whitespace IFS character problem
@ 2017-08-04  2:03 Martijn Dekker
  2017-08-04 10:56 ` Stephane Chazelas
  2017-08-06 18:08 ` Peter Stephenson
  0 siblings, 2 replies; 7+ messages in thread
From: Martijn Dekker @ 2017-08-04  2:03 UTC (permalink / raw)
  To: Zsh hackers list

In field/word splitting, a final non-whitespace IFS delimiter character
is counted as an empty field. This is unlike every other current shell
(including current versions of pdksh, i.e. mksh and OpenBSD ksh).

Test script:

setopt shwordsplit
IFS=:
x=a:b:
set -- $x
echo $#

Expected output: 2
Actual output: 3

The POSIX standard appears pretty ambiguous on this:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05

https://osdn.jp/ticket/browse.php?group_id=3863&tid=35283#comment:3863:35283:1435293070
[click on "Show all old Histories" for complete discussion]

However, it turns out that the intention of the standard was clarified
back in 1995 (!) in:
http://www.open-std.org/JTC1/SC22/WG15/docs/rr/9945-2/9945-2-98.html

IOW, the intention of the POSIX standard is for IFS characters to be
field terminators rather than separators (in spite of the S in IFS).

Sorry if the timing of this is awkward (shortly before an upcoming release).

Thanks,

- M.


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

end of thread, other threads:[~2017-08-08 12:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04  2:03 shwordsplit: final non-whitespace IFS character problem Martijn Dekker
2017-08-04 10:56 ` Stephane Chazelas
2017-08-04 11:13   ` Peter Stephenson
2017-08-06 18:08 ` Peter Stephenson
2017-08-06 20:01   ` Peter Stephenson
2017-08-08 10:56     ` Kamil Dudka
2017-08-08 12:17       ` 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).