* [BUG] zgetdir() in a directory of a bind mount returns "."
@ 2006-11-04 19:24 Matthias Lederhofer
2006-11-05 7:44 ` Matthias Lederhofer
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lederhofer @ 2006-11-04 19:24 UTC (permalink / raw)
To: zsh-workers
Hi,
This happened when I ran sudo because sudo unsets $PWD. Example how
to reproduce this (worked on multiple machines running linux):
# 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 source and target directory of the bind mount have to be in
different directories. With -DUSE_GETCWD=1 the bug does not occur.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] zgetdir() in a directory of a bind mount returns "."
2006-11-04 19:24 [BUG] zgetdir() in a directory of a bind mount returns "." Matthias Lederhofer
@ 2006-11-05 7:44 ` Matthias Lederhofer
2008-12-29 6:13 ` Clint Adams
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Lederhofer @ 2006-11-05 7:44 UTC (permalink / raw)
To: zsh-workers
The problem is that one device can be mounted on itself using bind
mounts. In this case in line 311 of compat.c pdev and dev are equal
but the inodes differ because readdir() returns the inode of the
target directory of the bind mount and stat(".") in line 252 returned
the inode of the source directory.
Undefining HAVE_STRUCT_DIRENT_D_INO works and I don't know if there is
any other way to work with bind-mounts than not using the inode
returned by readdir().
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] zgetdir() in a directory of a bind mount returns "."
2006-11-05 7:44 ` Matthias Lederhofer
@ 2008-12-29 6:13 ` Clint Adams
0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2008-12-29 6:13 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: zsh-workers, 397334
On Sun, Nov 05, 2006 at 08:44:35AM +0100, Matthias Lederhofer wrote:
> The problem is that one device can be mounted on itself using bind
> mounts. In this case in line 311 of compat.c pdev and dev are equal
> but the inodes differ because readdir() returns the inode of the
> target directory of the bind mount and stat(".") in line 252 returned
> the inode of the source directory.
> Undefining HAVE_STRUCT_DIRENT_D_INO works and I don't know if there is
> any other way to work with bind-mounts than not using the inode
> returned by readdir().
I think I recall something similar happening with chroots.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-12-29 6:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-04 19:24 [BUG] zgetdir() in a directory of a bind mount returns "." Matthias Lederhofer
2006-11-05 7:44 ` Matthias Lederhofer
2008-12-29 6:13 ` Clint Adams
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).