Package: zsh
Version: 4.3.2-22

The bug occurs when $PWD points to the wrong directory (stat for $PWD
and . differ) and the current directory is in a bind mount with source
and target directory on the same device.  The source and target
directory must not be in the same directory.

This bug can be reproduced running this:
    # setup
    mkdir -p /tmp/a/b/c /tmp/bind
    mount -o bind /tmp/a/b /tmp/bind
    cd /tmp/bind
    # bug if output is "."
    PWD=/tmp zsh -c pwd
    # cleanup
    cd /
    umount /tmp/bind
    rm -r /tmp/a /tmp/bind

The bug is in zgetdir().  The assumption made by zsh is:
"If st_dev (from stat) for . and .. is the same then the inode for .
reported by stat will be the same as the inode reported by readdir for
the directory entry of . in .."
This is not true for bind mounts with source and target directory on
the same device: the directory entry has the inode of the target
directory of the mount.  This can be found in compat.c:311.

Not defining HAVE_STRUCT_DIRENT_D_INO or defining USE_GETCWD helps, I
don't know if there is any other good way to solve this.

I also reported this to the zsh-workers mailing list
(http://www.zsh.org/mla/workers/2006/msg00847.html).


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to