From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 8689b12a for ; Thu, 25 Jul 2019 00:47:33 +0000 (UTC) Received: (qmail 9161 invoked by alias); 24 Jul 2019 16:31:02 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24095 Received: (qmail 14767 invoked by uid 1010); 24 Jul 2019 16:31:02 -0000 X-Qmail-Scanner-Diagnostics: from mail-lj1-f175.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25517. spamassassin: 3.4.2. Clear:RC:0(209.85.208.175):SA:0(-1.9/5.0):. Processed in 3.582091 secs); 24 Jul 2019 16:31:02 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.208.175 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wX87x4eWNLCZcHGj/afBKmhjnE8aDvHgKpkKbGbbQiU=; b=zba1IeWoEHgwja1ROMkGn4gbkScj/A6srMWyomw99u29GPU8NXWwSViHAJ31DXzxnK rkkgvbVPwlO2XhA3zRDOEPfXo7NySTe6SFoT/D9brjc5lNCR6c6JZOU0M8v+9fV9XdFX WcoP9cWYTp/lgqaWD/adNbVNKWv3XbcRLLRbIVVuyeEfSZYtJDfgdscpvhI+Is1b29kA CkIFbMgz4oKddQdmBPd956Ws9+GFvidgj+vSnRuYmF3M9SO3lI7QYhVqnfAMK4rIuRFa 5pzToVtxbDzXJeMA1OrYFPeZfd47OkjM8Cz4FbALZwuPX+b5vea4UIRT/rHwzJjuiC/e xuXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wX87x4eWNLCZcHGj/afBKmhjnE8aDvHgKpkKbGbbQiU=; b=MboItAjfRS0tH2K8YOASuEBrXTiNZBejHPrDo+KaJNZXTw0/eOiZYKeTTOpLWz6irq dc6a7x9tAEk3kXAjrKtpsjZvKrNBbOAlwe3LC9Fh9wk849ylwquhZuCAfveViIP3Xwo8 3ZMmQIA3SDQZ8Iusy6TBW3IGlaXUti33XBIXa1B6Wa8L3ZvEIcJyn/ZpZs3E+PvRlHae 64aqOWwIHrMSNM9SxDDGwxKvtYQci/v8GIXPPHvrpAVMumaEfImrPda23ptEA+uuTCxq ySh/c7Xq7actvzAuTrTT6R/XvgqrTWEXA131fXNqSOAjGh0IMskXGMhcJAJYabuhoYWB cQhA== X-Gm-Message-State: APjAAAXSK+Hq40FI0FzYaYtlTLPB4wB6/1Msf2fNosOKHO2mKY7fa4G6 b/tDJbjBtZ7F6D3A0tuJmEzrFn2ZgfgwYUgMCR0= X-Google-Smtp-Source: APXvYqy8m6Xfne4aCfGd/E0zrQz/elGEJzUj7Iokl0hPXVkDQIVkzb1FLA664SsyocOsK48dRvXptwh4ToRnkrPFEK0= X-Received: by 2002:a2e:b60f:: with SMTP id r15mr43085797ljn.172.1563985824359; Wed, 24 Jul 2019 09:30:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Wed, 24 Jul 2019 09:30:12 -0700 Message-ID: Subject: Re: zsh in sh compatibility mode splits IFS slightly differently from other shells To: Avery Pennarun Cc: Zsh Users Content-Type: multipart/alternative; boundary="0000000000007eb724058e6fd3f7" --0000000000007eb724058e6fd3f7 Content-Type: text/plain; charset="UTF-8" On Wed, Jul 24, 2019, 1:03 AM Avery Pennarun wrote: > Hi all, > > I think this may be a known bug, as you can see it documented here: > https://www.in-ulm.de/~mascheck/various/ifs/ > > However, it bit users of one of my scripts lately > (https://github.com/apenwarr/redo/blob/master/minimal/do) because it > was accidentally depending on the non-sh behaviour. > > Simple test: > > emulate sh > x="/a/b/c/" > IFS=/ > f() { > echo "$2" "$#" > } > f $x > > On zsh, this prints: > a 5 > > on bash, dash, mksh, ksh93, and posh (at least), this prints: > a 4 > > I've already worked around the problem in my script, but it would be > nice if nobody ever has to experience this again. Would it be possible > to change zsh to match other shells' behaviour, at least when in sh > compatibility mode? > > Thanks, > > Avery > --0000000000007eb724058e6fd3f7--