From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20011 invoked by alias); 24 Mar 2018 20:30:49 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42523 Received: (qmail 17519 invoked by uid 1010); 24 Mar 2018 20:30:49 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.59.109.123):SA:0(-1.9/5.0):. Processed in 1.913946 secs); 24 Mar 2018 20:30:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Subject: Re: [doc] "sh_word_split nothing to do with word splitting"? To: zsh-workers@zsh.org References: <20180311094458.GA6450@chaz.gmail.com> <180311112407.ZM2303@torch.brasslantern.com> <20180311205348.GC6450@chaz.gmail.com> <20180312074329.GA6416@chaz.gmail.com> From: Martijn Dekker Message-ID: Date: Sat, 24 Mar 2018 21:17:48 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180312074329.GA6416@chaz.gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit 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.