From: "Lawrence Velázquez" <larryv@zsh.org>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Discrepancy in IFS handling (zsh is POSIX compliant)
Date: Thu, 30 Mar 2023 08:05:10 -0400 [thread overview]
Message-ID: <D5349F8B-5D85-4E62-9FBC-520181FEC6A9@zsh.org> (raw)
In-Reply-To: <CAMP44s31HWYdR+Qn7w7yxzsboheEf_6xFv4yv6qGS8NBT_pqhA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
> On Mar 30, 2023, at 7:13 AM, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> However, this is what POSIX says:
>
> 3.b. Each occurrence in the input of an IFS character that is not
> IFS white space, along with any adjacent IFS white space, shall
> delimit a field, as described previously.
>
> We ignore all the white space stuff (since we are not using white
> spaces), and thus:
>
> Each occurrence in the input of an IFS character shall delimit a field.
>
> In zsh each occurrence of a comma does delimit a field (4 commas, 5
> fields), which to me is what POSIX says should happen.
>
> So in this particular case it seems zsh is complying with POSIX (even
> in zsh mode), and all other shells are not.
Before the excerpt you quoted, XCU 2.6.5 says: “The shell shall treat each character of the IFS as a delimiter and use the delimiters as field terminators to split the results of parameter expansion, command substitution, and arithmetic expansion into fields.”
The bash/dash/ksh behavior is not unreasonable if the phrase “field terminators” is interpreted strictly.
In any case, I believe the standard intends to describe the ksh behavior:
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_06_05
--
vq
Sent from my iPhone
[-- Attachment #2: Type: text/html, Size: 2862 bytes --]
next prev parent reply other threads:[~2023-03-30 12:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 11:11 Felipe Contreras
2023-03-30 12:05 ` Lawrence Velázquez [this message]
2023-03-30 12:10 ` Discrepancy in IFS handling (zsh is *not* " Felipe Contreras
2023-03-30 14:49 ` Ray Andrews
2023-03-30 15:09 ` Felipe Contreras
2023-03-30 15:31 ` Ray Andrews
2023-03-30 14:57 ` Bart Schaefer
2023-03-30 15:34 ` Felipe Contreras
2023-03-31 20:16 ` Discrepancy in IFS handling (zsh is " Felipe Contreras
2023-04-01 19:20 ` Lawrence Velázquez
2023-03-31 16:38 ` Thomas Paulsen
2023-03-31 20:18 ` Felipe Contreras
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=D5349F8B-5D85-4E62-9FBC-520181FEC6A9@zsh.org \
--to=larryv@zsh.org \
--cc=felipe.contreras@gmail.com \
--cc=zsh-users@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).