From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5447 invoked by alias); 4 Aug 2017 10:56:11 -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: X-Seq: 41488 Received: (qmail 4922 invoked by uid 1010); 4 Aug 2017 10:56:10 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f169.google.com 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(209.85.128.169):SA:0(-2.8/5.0):. Processed in 1.120068 secs); 04 Aug 2017 10:56:10 -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=-2.8 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=u3WzSvKdG7lUqsW0E4V2OQ9JKmlwdfqpaWlce+zvgDs=; b=GHm5zcaONnA6dPU/sHiCNf0j4nNDyDjKyM4Re0+N8Y+uYDvnFnryUZPCqpZrSZnKeT qSYX/OPtCg5P8dTa5UxZy98S8q91qwHJLURSz/wm/HiUiQU01BDEuhgIMEDRqcZATZP7 nO0VMuBi3bN7bB0r0ZhTUSZYX6f/y7SuFwJUPpTNgpzMX9r9hK+el7WiM+ce0x8hd0f9 ZYQSgxBQk6fLoqXTz282BDtCTBHBECwHq2Zm3T02xiX4SihOS3+nPM9K4Q3UxLNLd//B akHA+l6HvaQfeZww8btNty9OrfLkdIvx0fMtM/KELix5SS3ZgCcj0T93y7lgGC1Ej1I7 VMzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=u3WzSvKdG7lUqsW0E4V2OQ9JKmlwdfqpaWlce+zvgDs=; b=Idu6UCcqVWNHEw5I9aPhICh5hZs9E5HFhmJEsQ0YxepSmicMYojOv1p6sO1tAunCag +oxlY7wvgEovZnF26rolJx2ki+47pS3nYiZdnYB24X3TI9iYsr7Kw1D780f2WeGrOoJ2 riPwPU4yirTEx25fW/qQJ6aiLJr9/KGq9jFbR1a9rKd7g4OxsXH1jE4KWQOqJesarDlu rh66+2SDKXBjdb8uSGBLT1OVrO18RRBNTgMbBVOvZl10eHdRAn4faGMXKEv+NkSg4Rru FKcNbcmkqmqTdQ+McAYec992oaomUm9+srsIV61LD3VOxoJgqdDa/u6KwWlq0YxX79qe K6gg== X-Gm-Message-State: AIVw111fl0Sc+8DNoyPKEzMnIHOKmpmE8Y4ww83Xo2fbV9A/O9s+lc3r 3hgZ3BKIE37dQQ== X-Received: by 10.223.136.231 with SMTP id g36mr1518129wrg.280.1501844163051; Fri, 04 Aug 2017 03:56:03 -0700 (PDT) Date: Fri, 4 Aug 2017 11:56:01 +0100 From: Stephane Chazelas To: Martijn Dekker Cc: Zsh hackers list Subject: Re: shwordsplit: final non-whitespace IFS character problem Message-ID: <20170804105601.GA10499@chaz.gmail.com> Mail-Followup-To: Martijn Dekker , Zsh hackers list References: <0f71b764-cc3d-5274-a16a-498b792bff6e@inlv.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f71b764-cc3d-5274-a16a-498b792bff6e@inlv.org> User-Agent: Mutt/1.5.24 (2015-08-30) 2017-08-04 04:03:19 +0200, Martijn Dekker: > 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 $# [...] IIRC, it was discussed before, and the concensus at the time was that it would be silly as the S in IFS stands for *S*eparator, not terminator nor delimiter. At the time though, a number of shells (pdksh and ash based ones) still behaved like zsh and not ksh88 and POSIX was even less clear about it. Note that, it also affects "read", where "IFS=: read var" on an output that contains "word:" should (as per POSIX) store "word" into "var" (while it "should" store "word1:word2:" on a line with "word1:word2:"). I can't imagine changing the behaviour in the sh/ksh emulations would be a problem (though I still think it's silly). Note that with that semantic, you can no longer do things like: IFS=: set -o noglob for dir in $PATH; do ... done You need to use some kludge like the "which" POSIX script does on Debian to account for PATHs like "/bin:/usr/bin:". -- Stephane