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

zgetcwd with bind mounts



Hi,

It seems zgetcwd can't handle bind mounts, leading to rather surprising
behaviour.

# echo $ZSH_VERSION $ZSH_PATCHLEVEL
4.3.10 Debian
# pwd
/home/ajrh
# mkdir -p /tmp/xvar
# mount --bind /var /tmp/xvar
# pwd
/home/ajrh
# env | grep PWD
PWD=/home/ajrh OLDPWD=/home/ajrh
# perl -e 'chdir("/tmp/xvar/log/samba"); system qw(dash -c /bin/pwd)'
/tmp/xvar/log/samba
# perl -e 'chdir("/tmp/xvar/log/samba"); system qw(bash -c /bin/pwd)'
/tmp/xvar/log/samba
# perl -e 'chdir("/tmp/xvar/log/samba"); system qw(zsh -c /bin/pwd)'
/tmp/xvar

I suspect this check in zgetdir is close to the problem; the dev != pdev
test is not sufficient to detect bind mounts.
# ifdef HAVE_STRUCT_DIRENT_D_INO
            if (dev != pdev || (ino_t) de->d_ino == ino)
# endif /* HAVE_STRUCT_DIRENT_D_INO */

For QNX and cygwin, zsh simply uses getcwd() instead of this code - why
is that not used generally?

Anthony



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