From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7415 invoked by alias); 4 Oct 2017 22:35:58 -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: 41811 Received: (qmail 7488 invoked by uid 1010); 4 Oct 2017 22:35:58 -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.830848 secs); 04 Oct 2017 22:35:58 -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,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: | From: Martijn Dekker Subject: [bug] sh: tilde expansion after field splitting To: Zsh hackers list Message-ID: <06fb6a91-6766-bbd7-9543-cbafe704ee59@inlv.org> Date: Thu, 5 Oct 2017 00:20:44 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit POSIX says tilde expansion should be done before parameter expansion and certainly before field spplitting (shwordsplit): http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06 zsh did this correctly up to version 5.0.8; as of 5.1, it appears to do tilde expansion *after* field splitting, and only from the second field on. Test script: emulate sh v='~/one ~/two ~/three' printf '[%s]\n' $v Actual output: [~/one] [/Users/martijn/two] [/Users/martijn/three] Expected output: [~/one] [~/two] [~/three] Thanks, - M.