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=-1.0 required=5.0 tests=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 0a0c3856 for ; Sat, 1 Feb 2020 04:24:41 +0000 (UTC) Received: (qmail 14717 invoked by alias); 1 Feb 2020 04:24:33 -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: 45368 Received: (qmail 17183 invoked by uid 1010); 1 Feb 2020 04:24:33 -0000 X-Qmail-Scanner-Diagnostics: from wout2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25703. spamassassin: 3.4.2. Clear:RC:0(64.147.123.25):SA:0(-2.6/5.0):. Processed in 4.387255 secs); 01 Feb 2020 04:24:33 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrgedugdeilecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkjghfofggtgfgsehtjedttdertddvnecuhfhrohhmpeffrghnihgv lhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenuc fkphepjeelrddukedtrdehjedrudduleenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Date: Sat, 1 Feb 2020 04:23:49 +0000 From: Daniel Shahaf To: Martijn Dekker Cc: Zsh hackers list Subject: Re: [BUG] 'cd -P' leaves double slash in $PWD Message-ID: <20200201042349.447e6a96@tarpaulin.shahaf.local2> In-Reply-To: <963eb2c3-e6e6-15e9-9c3a-964b49c6b2c0@inlv.org> References: <963eb2c3-e6e6-15e9-9c3a-964b49c6b2c0@inlv.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Martijn Dekker wrote on Sat, 01 Feb 2020 03:15 +0100: > $ zsh -c 'cd -P ////dev//; echo $PWD' > //dev > > Expected output: /dev > > A double initial slash in a canonicalised/normalised path is okay if the > original started with a double slash (as this could signify a Cygwin UNC > network path), but not if it started with one or more than two slashes. > > Bug confirmed on zsh from current back to 5.0.8 (I didn't test earlier > versions). > Thanks. Tests: diff --git a/Test/B01cd.ztst b/Test/B01cd.ztst index 3312f8707..ed56d839f 100644 --- a/Test/B01cd.ztst +++ b/Test/B01cd.ztst @@ -145,6 +145,10 @@ F:something is broken. But you already knew that. 1:Implicit cd with unset HOME. ?zsh:cd:1: HOME not set + $ZTST_testdir/../Src/zsh -fc 'cd -P ////dev && pwd' +-f:cd -P squashes multiple leading slashes +>/dev + %clean # This optional section cleans up after the test, if necessary, # e.g. killing processes etc. This is in addition to the removal of *.tmp diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst index 3d7df94c9..76e1132c3 100644 --- a/Test/D02glob.ztst +++ b/Test/D02glob.ztst @@ -742,6 +742,10 @@ >glob.tmp/secret-s111/ glob.tmp/secret-s111 >glob.tmp/secret-s444/ glob.tmp/secret-s444 + () { echo $1:P } ////dev +-f:modifier ':P' squashes multiple slashes +>/dev + %clean # Fix unreadable-directory permissions so ztst can clean up properly That doesn't handle the Cygwin double slashes case, but I don't have a Cygwin box to test on. If someone knows how to change the expectations for Cygwin, please do. @all Please don't consider fixing this bug to be a licked cookie. I.e., if you want to look into fixing this, please do; I'm _not_ taking ownership of that. Thanks. Cheers, Daniel