zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Martijn Dekker <martijn@inlv.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] 'cd -P' leaves double slash in $PWD
Date: Sat, 1 Feb 2020 04:23:49 +0000	[thread overview]
Message-ID: <20200201042349.447e6a96@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <963eb2c3-e6e6-15e9-9c3a-964b49c6b2c0@inlv.org>

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

      reply	other threads:[~2020-02-01  4:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-01  2:15 Martijn Dekker
2020-02-01  4:23 ` Daniel Shahaf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200201042349.447e6a96@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=martijn@inlv.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).