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

Re: :P test failure



Peter Stephenson wrote on Thu, 26 Mar 2020 21:27 +0000:
> This doesn't work on my machine:
> 
>  # This is a bit brittle as it depends on PATH_MAX.
>  # We could use sysconf..
>  bad_pwd="/${(l:16000:: :):-}"
>  print ${bad_pwd:P} | wc -c
> 0:modifier ':P' with path too long
> >16002  
> 
> The modification fails with error and output
> 
> zsh: path expansion failed, using root directory
> 2

The behaviour you see is exactly what the test's _expected_ output was
before 45583/0004.  Is there any chance that you ran HEAD's tests on an
old zsh binary by accident?

What's the value of errno?  (Patch at the end for your convenience)

Cheers,

Daniel

diff --git a/Src/utils.c b/Src/utils.c
index 69885fed3..8a7558700 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1030,8 +1030,9 @@ xsymlink(char *s, int heap)
     if (*s != '/')
 	return NULL;
     *xbuf = '\0';
+    errno = 0;
     if (!chrealpath(&s, 'P', heap)) {
-	zwarn("path expansion failed, using root directory");
+	zwarn("path expansion failed (%e) using root directory", errno);
 	return heap ? dupstring("/") : ztrdup("/");
     }
     return s;



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