[Pkg-zsh-devel] Bug#607615: zsh: Behavior of ":A" and ":a" isn't clear and seems wrong

Daniel Shahaf d.s at daniel.shahaf.name
Fri Jul 22 06:29:49 UTC 2016


Control: tags -1 fixed-upstream

Vincent Lefevre wrote on Mon, Dec 20, 2010 at 11:17:05 +0100:
> How the path is resolved should be clarified, in particular because
> one doesn't get the same result as realpath for the first test. The
> zshexpn(1) man page currently says:
> 
>      a      Turn a file name into an absolute  path:   prepends  the
>             current directory, if necessary, and resolves any use of
>             `..' and `.' in the path.  Note that the  transformation
>             takes place even if the file or any intervening directo‐
>             ries do not exist.
> 
>      A      As `a', but also resolve use  of  symbolic  links  where
>             possible.   Note  that  resolution of `..' occurs before
>             resolution of symbolic links.  This call  is  equivalent
>             to  a  unless  your  system has the realpath system call
>             (modern systems do).
> 
> The fact that it refers to the realpath call (BTW this is not a
> system call, but a GNU libc call under Linux) is strange because
> neither ":a" not ":A" give the same result as realpath.

Docs clarified upstream in users/21777, users/21779, and [soon]
users/21784.

> Moreover the error condition (no matches found) is inconsistent,
> as /tmp/foo/foo/symlink-to-dot doesn't exist either.

    echo symlink-to-dot/../$d/does-not-exist(:A)
.
yields "no matches found" because the NULLGLOB option is unset (and the
part before the qualifiers does not exist, according to stat()).  The
other case,
.
    echo symlink-to-dot/../$d/symlink-to-dot(:A)
.
, behaves as documented.  In particular, it performs the transformation
even though /tmp/foo/$d does not exist.

I note the upstream threads have proposed adding a :P modifier that
simply transforms the argument using realpath(3), however, no patch
implementing that has yet been submitted.

Cheers,

Daniel



More information about the Pkg-zsh-devel mailing list