Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bug with $PWD in /



Bart Schaefer wrote on Sat, Sep 19, 2015 at 13:47:40 -0700:
> On Sep 19,  8:28pm, Stephane Chazelas wrote:
> } Subject: Re: bug with $PWD in /
> }
> } So, the should recompute $PWD if the one it gets from the
> } environment is a relative path (it's not only about . or ..,
> } think of symlinks).
> 
> It'd have to be a symlink from the current directory to itself, tho.
> Other symbolic links are explicitly permitted by the text you quoted.

Looking at the sole caller of ispwd(), setupvals(), it sometimes
initializes $PWD from getenv("HOME").  Is something like this needed,
then?

Or perhaps the condition should be "if not POSIX" rather than "if zsh".

diff --git a/Src/init.c b/Src/init.c
index 22db4b3..24a50c7 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1019,7 +1019,7 @@ setupvals(void)
        ptr = home;
     else
        ptr = zgetenv("HOME");
-    if (ptr && ispwd(ptr))
+    if (EMULATION(EMULATE_ZSH) && ptr && ispwd(ptr))
        pwd = ztrdup(ptr);
     else if ((ptr = zgetenv("PWD")) && (strlen(ptr) < PATH_MAX) &&
             (ptr = metafy(ptr, -1, META_STATIC), ispwd(ptr)))



Messages sorted by: Reverse Date, Date, Thread, Author