zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Subject: Re: [doc] "sh_word_split nothing to do with word splitting"?
Date: Sat, 24 Mar 2018 21:17:48 +0100	[thread overview]
Message-ID: <a701f581-d2f5-bab8-6943-ac3630bf533d@inlv.org> (raw)
In-Reply-To: <20180312074329.GA6416@chaz.gmail.com>

Op 12-03-18 om 08:43 schreef Stephane Chazelas:
> I'd rather zsh keep it that way as a statement of resistance
> against silliness, at least until someone complains that his
> POSIX script fails when run on zsh because its arithmetic
> expansions are not split as expected.

The thing is, there are very good reasons for that silliness, and for
not resisting it in sh emulation.

In a way, POSIX is primarily descriptive, not prescriptive. It intends
to incorporate the historical practice that real-world shell
implementations have copied into the standard, so that everyone can be
compatible with it.

For the most part, that historical practice was established by AT&T
ksh88. It's mostly obsolete now but very much lives on in all the shells
that copy its behaviour.

ksh88 implemented the original shell arithmetic expansion. It subjects
those expansions to IFS field splitting.

Not emulating this in zsh's sh emulation mode will probably not cause
many scripts to fail on zsh-as-sh. However, someone could use zsh to
develop a POSIX script intended to be compatible with other shells.

And that someone might end up under the mistaken impression that it's
pointless to quote arithmetic expansions. Cue potential mysterious
breakage on non-zsh shells.

That's why I believe it's important that this is fixed in sh emulation.

> pdksh was not doing word/field splitting there and posh and
> OpenBSD sh still don't.

Then pdksh, supposedly a ksh88 clone, failed to clone ksh88 in that
aspect -- among many others.

pdksh, posh, NetBSD ksh, OpenBSD sh/ksh, and nearly all other pdksh
derivatives are all full of bugs and fatally broken when it comes to
implementing POSIX compatibility.

The only properly working pdksh derivative is mksh (and its "legacy"
even-more-POSIX companion lksh).

- M.


  parent reply	other threads:[~2018-03-24 20:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-11  9:44 Stephane Chazelas
2018-03-11 18:24 ` Bart Schaefer
2018-03-11 20:53   ` Stephane Chazelas
2018-03-11 23:41     ` Martijn Dekker
2018-03-12  7:43       ` Stephane Chazelas
2018-03-12  8:07         ` Stephane Chazelas
2018-03-16 17:26           ` Stephane Chazelas
2018-03-16 18:28             ` Bart Schaefer
2018-03-16 19:33               ` Stephane Chazelas
2018-03-24 20:17         ` Martijn Dekker [this message]
2018-03-25  6:42           ` Stephane Chazelas
2018-03-26 18:11             ` 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=a701f581-d2f5-bab8-6943-ac3630bf533d@inlv.org \
    --to=martijn@inlv.org \
    --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).