Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh

From: Jim Meyering <[email-masked]>
Date: Thu, 25 Oct 2012 13:01:00 +0200

[email-masked] wrote:
> A new test in 8.20 fail because "mount point 'a/b' already traversed"
> is not emitted
>
> [chroot-i486] root:/usr/src/coreutils-8.20$ uname -r; mount --version
> 3.4.15
> mount from util-linux 2.22.1 (libmount 2.22.0: debug)
>
> [chroot-i486] root:/usr/src/coreutils-8.20$ FORCE_UNSAFE_CONFIGURE=1
> ./configure --prefix=/usr --disable-nls
> --enable-no-install-program=kill,uptime
> ...
> [chroot-i486] root:/usr/src/coreutils-8.20$ make check
> TESTS=tests/du/bind-mount-dir-cycle.sh
> ...
> FAIL: tests/du/bind-mount-dir-cycle.sh (exit: 1)
> ...
> + mkdir -p a/b
> + mount --bind a a/b
> + echo a
> + echo 'du: mount point '\''a/b'\'' already traversed'
> + du a
> + sed 's/^[0-9][0-9]*   //' out
> + mv k out
> + compare exp-err err
> + compare_dev_null_ exp-err err
> + test 2 = 2
> + test xexp-err = x/dev/null
> + test xerr = x/dev/null
> + return 2
> + case $? in
> + compare_ exp-err err
> + diff -u exp-err err
> --- exp-err     2012-10-25 09:24:00.000000000 +0200
> +++ err 2012-10-25 09:24:00.000000000 +0200
> @@ -1 +1,6 @@
> -du: mount point 'a/b' already traversed
> +du: WARNING: Circular directory structure.
...
> I attached the result of strace -o du-bind-mount-dir-cycle.log -s100 -f du a
...
> 3467  stat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> 3467  stat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
> 3467  stat64("/dev/pts", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
> 3467  stat64("/sys", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
> 3467  stat64("/dev/shm", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=40, ...}) = 0
> 3467  fstatat64(AT_FDCWD, "a", {st_mode=S_IFDIR|0755, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
> 3467  openat(AT_FDCWD, "a", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_NOFOLLOW) = 3
...

Thanks for the report.

That shows that the mount-listing code does not include the
bind-mounted a/b on your system.  Here's what I see on
Fedora 17, 18, and rawhide:

    # mkdir -p a/b && mount --bind a a/ strace -e stat /cu/src/du a
    stat("/", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
    stat("/sys", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
    ...
    stat("/t/a/b", {st_mode=S_IFDIR|0700, st_size=60, ...}) = 0
    /cu/src/du: mount point 'a/b' already traversed
    0       a
    +++ exited with 1 +++

I can see it in /proc/mounts, too:

    $ grep a/b /proc/mounts                                                 :
    tmpfs /t/a/b tmpfs rw,seclabel,relatime,size=5345280k 0 0

There must be something different about your system.