Package: zsh
Version: 4.3.10-17
Severity: normal

Consider the following zsh script:

d=$PWD:t
ln -s . symlink-to-dot || exit 1
realpath symlink-to-dot/../$d/symlink-to-dot
realpath symlink-to-dot/../$d/does-not-exist
echo symlink-to-dot/../$d/symlink-to-dot(:A)
echo symlink-to-dot/../$d/does-not-exist(:A)
echo symlink-to-dot/../$d/symlink-to-dot(:a)
echo symlink-to-dot/../$d/does-not-exist(:a)
rm symlink-to-dot

When run under some /tmp/foo directory, one gets:

/tmp/foo
symlink-to-dot/../foo/does-not-exist: No such file or directory
/tmp/foo/foo/symlink-to-dot
no matches found: symlink-to-dot/../foo/does-not-exist(:A)
/tmp/foo/foo/symlink-to-dot
no matches found: symlink-to-dot/../foo/does-not-exist(:a)

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.

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

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zsh depends on:
ii  libc6                     2.11.2-7       Embedded GNU C Library: Shared lib
ii  libcap2                   1:2.19-3       support for getting/setting POSIX.
ii  libncursesw5              5.7+20100313-4 shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libc6                         2.11.2-7   Embedded GNU C Library: Shared lib
ii  libpcre3                      8.02-1.1   Perl 5 Compatible Regular Expressi

Versions of packages zsh suggests:
ii  zsh-doc                       4.3.10-17  zsh documentation - info/HTML form

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to