From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29753 invoked by alias); 13 Oct 2017 09:56:03 -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: 41876 Received: (qmail 802 invoked by uid 1010); 13 Oct 2017 09:56:03 -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.212412 secs); 13 Oct 2017 09:56:03 -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: | Subject: Re: [bug] sh: tilde expansion after field splitting References: <06fb6a91-6766-bbd7-9543-cbafe704ee59@inlv.org> <171008005347.ZM1177@torch.brasslantern.com> To: Zsh hackers list From: Martijn Dekker Message-ID: <4c5bad3d-fdf6-3eae-8bbe-ec443c740a36@inlv.org> Date: Fri, 13 Oct 2017 11:43:17 +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 In-Reply-To: <171008005347.ZM1177@torch.brasslantern.com> Content-Type: text/plain; charset=utf-8 Content-Language: nl Content-Transfer-Encoding: 7bit Op 08-10-17 om 09:53 schreef Bart Schaefer: > On Oct 5, 12:20am, Martijn Dekker wrote: > } Subject: [bug] sh: tilde expansion after field splitting > } > } POSIX says tilde expansion should be done before parameter expansion [...] > } 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. > > The patch below fixes this, I believe. Several comments: This introduces a bug with "$@", $@ and $* expansion: $ Src/zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" "$@$@"' [a] [b$@] $ Src/zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" $@$@' [a] [b$@] $ zsh -o SHFILEEXPANSION -c 'set "a" "b"; printf "[%s]\n" $*$*' zsh:1: no matches found: b$* Expected output for all three: [a] [ba] [b] Thanks, - M.