Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] 'cd -P' leaves double slash in $PWD
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author