GNU bug report logs - #12730
coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh

Previous Next

Package: coreutils;

Reported by: g.esp <at> free.fr

Date: Thu, 25 Oct 2012 08:46:01 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12730 in the body.
You can then email your comments to 12730 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 08:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to g.esp <at> free.fr:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 25 Oct 2012 08:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: bug-coreutils <at> gnu.org
Subject: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 10:43:12 +0200 (CEST)
[Message part 1 (text/plain, inline)]
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.
+This almost certainly means that you have a corrupted file system.
+NOTIFY YOUR SYSTEM MANAGER.
+The following directory is part of the cycle:
+  'a/b'
+
+ fail=1
+ compare exp out
+ compare_dev_null_ exp out
+ test 2 = 2
+ test xexp = x/dev/null
+ test xout = x/dev/null
+ return 2
+ case $? in
+ compare_ exp out
+ diff -u exp out
+ Exit 1
+ set +e
+ exit 1
+ exit 1
+ remove_tmp_
+ __st=1
+ cleanup_
+ umount a/b

I attached the result of strace -o du-bind-mount-dir-cycle.log -s100 -f du a

Gilles
[du-bind-mount-dir-cycle.log (text/x-log, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 11:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 13:01:00 +0200
g.esp <at> free.fr 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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 11:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 13:13:58 +0200 (CEST)

----- Mail original -----
> De: "Jim Meyering" <jim <at> meyering.net>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12730 <at> debbugs.gnu.org
> Envoyé: Jeudi 25 Octobre 2012 13:01:00
> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
> 
> g.esp <at> free.fr 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.
> 
That's another time a regular /etc/mtab issue

chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ ln -sf /proc/mounts /etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
[chroot-i486] root:/usr/src/coreutils-8.20$ du a
du: mount point 'a/b' already traversed
4       a

[chroot-i486] root:/usr/src/coreutils-8.20$ umount a/b
[chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ grep ' / ' /proc/mounts >/etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
[chroot-i486] root:/usr/src/coreutils-8.20$ du a
du: WARNING: Circular directory structure.
This almost certainly means that you have a corrupted file system.
NOTIFY YOUR SYSTEM MANAGER.
The following directory is part of the cycle:
  'a/b'

4       a

I send a patch that fixed the test for me adding the regular mtab case message.
I don't know if this is the proper way to fix the issue or if that uncover a bug in du code.

The comment on this test cleanup_ make me smile.

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 12:22:02 GMT) Full text and rfc822 format available.

Message #14 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 14:19:12 +0200
g.esp <at> free.fr wrote:
...
>> 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.
>>
> That's another time a regular /etc/mtab issue
>
> chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ ln -sf /proc/mounts /etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
> [chroot-i486] root:/usr/src/coreutils-8.20$ du a
> du: mount point 'a/b' already traversed
> 4       a
>
> [chroot-i486] root:/usr/src/coreutils-8.20$ umount a/b
> [chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ grep ' / ' /proc/mounts >/etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
> [chroot-i486] root:/usr/src/coreutils-8.20$ du a
> du: WARNING: Circular directory structure.
> This almost certainly means that you have a corrupted file system.
> NOTIFY YOUR SYSTEM MANAGER.
> The following directory is part of the cycle:
>   'a/b'
>
> 4       a

> I send a patch that fixed the test for me adding the regular mtab case message.
> I don't know if this is the proper way to fix the issue or if that
> uncover a bug in du code.

Thanks for the patch, but at least for now, it seems to me like
that test is failing because your chroot is improperly configured.
I.e., when your system configuration makes it impossible to obtain
a list of mount points using a relatively standard API, a failing
test serves as a heads up.

> The comment on this test cleanup_ make me smile.

Thanks.  That deserves a patch:

From 46388ce46ec478b0801ec5b217f5004137afa870 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim <at> meyering.net>
Date: Thu, 25 Oct 2012 13:41:45 +0200
Subject: [PATCH] maint: remove an obsolete test comment

* tests/du/bind-mount-dir-cycle.sh: Remove obsolete comment
spotted by Gilles Espinasse.
---
 tests/du/bind-mount-dir-cycle.sh | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/du/bind-mount-dir-cycle.sh b/tests/du/bind-mount-dir-cycle.sh
index d8d381a..92b4773 100755
--- a/tests/du/bind-mount-dir-cycle.sh
+++ b/tests/du/bind-mount-dir-cycle.sh
@@ -20,13 +20,7 @@
 print_ver_ du
 require_root_

-cleanup_()
-{
-  # When you take the undesirable shortcut of making /etc/mtab a link
-  # to /proc/mounts, unmounting "$other_partition_tmpdir" would fail.
-  # So, here we unmount a/b instead.
-  umount a/b
-}
+cleanup_() { umount a/b; }

 mkdir -p a/b || framework_failure_
 mount --bind a a/b \
--
1.8.0




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 16:17:01 GMT) Full text and rfc822 format available.

Message #17 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 18:14:05 +0200 (CEST)

----- Mail original -----
> De: "Jim Meyering" <jim <at> meyering.net>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12730 <at> debbugs.gnu.org
> Envoyé: Jeudi 25 Octobre 2012 14:19:12
> Objet: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
> 
...
> 
> Thanks for the patch, but at least for now, it seems to me like
> that test is failing because your chroot is improperly configured.
> I.e., when your system configuration makes it impossible to obtain
> a list of mount points using a relatively standard API, a failing
> test serves as a heads up.
> 

I fixed anything unusual in my setup and run the last long-term kernel, so the chroot is now almost very clean.

The line in /etc/mtab that let hash.c take a different code path is 
rootfs / rootfs rw 0 0

I have no issue removing that line in my chroot.

Is that rootfs line forbidden now?

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 16:25:01 GMT) Full text and rfc822 format available.

Message #20 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 18:22:21 +0200
g.esp <at> free.fr wrote:
> ----- Mail original -----
>> De: "Jim Meyering" <jim <at> meyering.net>
>> À: "g esp" <g.esp <at> free.fr>
>> Cc: 12730 <at> debbugs.gnu.org
>> Envoyé: Jeudi 25 Octobre 2012 14:19:12
>> Objet: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
>>
> ...
>>
>> Thanks for the patch, but at least for now, it seems to me like
>> that test is failing because your chroot is improperly configured.
>> I.e., when your system configuration makes it impossible to obtain
>> a list of mount points using a relatively standard API, a failing
>> test serves as a heads up.
>>
>
> I fixed anything unusual in my setup and run the last long-term
> kernel, so the chroot is now almost very clean.
>
> The line in /etc/mtab that let hash.c take a different code path is
> rootfs / rootfs rw 0 0

You wrote this:

  chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
  [chroot-i486] root:/usr/src/coreutils-8.20$ ln -sf /proc/mounts /etc/mtab
  [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
  [chroot-i486] root:/usr/src/coreutils-8.20$ du a
  du: mount point 'a/b' already traversed
  4       a

  [chroot-i486] root:/usr/src/coreutils-8.20$ umount a/b
  [chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
  [chroot-i486] root:/usr/src/coreutils-8.20$ grep ' / ' /proc/mounts >/etc/mtab
  [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
  [chroot-i486] root:/usr/src/coreutils-8.20$ du a
  du: WARNING: Circular directory structure.
  This almost certainly means that you have a corrupted file system.
  NOTIFY YOUR SYSTEM MANAGER.
  The following directory is part of the cycle:
    'a/b'

  4       a

Does the latter mount command arrange to add a line to the
one-line (root-only) /etc/mtab ?

To me, it looks like the *lack* of a line for the a/b mount
is the problem.  When you remove the symlink the mount command
does not update the regular-file /etc/mtab, so mount-listing
code cannot see that a/b is bind-mounted.

> I have no issue removing that line in my chroot.
>
> Is that rootfs line forbidden now?




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 18:12:02 GMT) Full text and rfc822 format available.

Message #23 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 20:08:56 +0200 (CEST)

----- Mail original -----
> De: "Jim Meyering" <jim <at> meyering.net>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12730 <at> debbugs.gnu.org
> Envoyé: Jeudi 25 Octobre 2012 18:22:21
> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
> 

> > The line in /etc/mtab that let hash.c take a different code path is
> > rootfs / rootfs rw 0 0
> 
I withdraw my conclusion concerning rootfs line.
I made something wrong during testing as I can't reproduce that result now.

> You wrote this:
> 
>   chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
>   [chroot-i486] root:/usr/src/coreutils-8.20$ ln -sf /proc/mounts /etc/mtab
>   [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
>   [chroot-i486] root:/usr/src/coreutils-8.20$ du a
>   du: mount point 'a/b' already traversed
>   4       a
> 
>   [chroot-i486] root:/usr/src/coreutils-8.20$ umount a/b
>   [chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
>   [chroot-i486] root:/usr/src/coreutils-8.20$ grep ' / ' /proc/mounts >/etc/mtab
>   [chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
>   [chroot-i486] root:/usr/src/coreutils-8.20$ du a
>   du: WARNING: Circular directory structure.
>   This almost certainly means that you have a corrupted file system.
>   NOTIFY YOUR SYSTEM MANAGER.
>   The following directory is part of the cycle:
>     'a/b'
> 
>   4       a
> 
> Does the latter mount command arrange to add a line to the
> one-line (root-only) /etc/mtab ?
> 
Yes
I created a/b by hand directly in /usr/src/coreutils-8.20.

[chroot-i486] root:/usr/src/coreutils-8.20$ grep '^\/dev.* / ' /proc/mounts >/etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ mount --bind a a/b
[chroot-i486] root:/usr/src/coreutils-8.20$ cat /etc/mtab
/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
/usr/src/coreutils-8.20/a /usr/src/coreutils-8.20/a/b none rw,bind 0 0

The behavior difference is in hash_lookup in if (bucket->data == NULL) test. I added a few printf to find that.
With symlink /etc/mtab, code go further, with regular /etc/mtab, code return NULL there.

> To me, it looks like the *lack* of a line for the a/b mount
> is the problem.  When you remove the symlink the mount command
> does not update the regular-file /etc/mtab, so mount-listing
> code cannot see that a/b is bind-mounted.
> 
No, this is not a missing line but understanding that line content.

To prove that, I started again with a new mtab,
- mounted a/b without writting to mtab
- copied to mtab a line content with a/b mounted exactly the same as in /proc/mounts case,
- hash_lookup answer changed
.
[chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ grep '^\/dev.* / ' /proc/mounts >/etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ mount -n --bind a a/b
[chroot-i486] root:/usr/src/coreutils-8.20$ echo '/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 /usr/src/coreutils-8.20/a/b ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0' >>/etc/mtab
[chroot-i486] root:/usr/src/coreutils-8.20$ ./src/du a
./src/du: mount point 'a/b' already traversed
4       a

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 19:40:01 GMT) Full text and rfc822 format available.

Message #26 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 21:37:08 +0200
g.esp <at> free.fr wrote:
...
>> To me, it looks like the *lack* of a line for the a/b mount
>> is the problem.  When you remove the symlink the mount command
>> does not update the regular-file /etc/mtab, so mount-listing
>> code cannot see that a/b is bind-mounted.
>>
> No, this is not a missing line but understanding that line content.
>
> To prove that, I started again with a new mtab,
> - mounted a/b without writting to mtab
> - copied to mtab a line content with a/b mounted exactly the same as
> in /proc/mounts case,
> - hash_lookup answer changed
> .
> [chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ grep '^\/dev.* / '
> /proc/mounts >/etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ mount -n --bind a a/b
> [chroot-i486] root:/usr/src/coreutils-8.20$ echo
> /dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8
> /usr/src/coreutils-8.20/a/b ext3
> rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0' >>/etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ ./src/du a
> ./src/du: mount point 'a/b' already traversed
> 4       a

It sounds like you have confirmed my conclusion.
When you use a symlink, /etc/mtab contains a line for the a/b mount
and the mount-listing loop in fill_mount_table inserts an entry for a/b.
Later, when we search that table for the inode of "a/b", we find
that entry and know that it's a bind-mount, so issue only the minor
warning, rather than the "DISK CORRUPTION" warning.

With your regular mtab file, it contains no such a/b line, and
the mount-listing loop in fill_mount_table inserts no entry for a/b.
Later, when we search that table for a/b's inode, we find no entry
and have to report the more serious error.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 20:58:01 GMT) Full text and rfc822 format available.

Message #29 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 22:54:46 +0200 (CEST)

----- Mail original -----
> De: "Jim Meyering" <jim <at> meyering.net>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12730 <at> debbugs.gnu.org
> Envoyé: Jeudi 25 Octobre 2012 21:37:08
> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
> 
...
> 
> It sounds like you have confirmed my conclusion.
> When you use a symlink, /etc/mtab contains a line for the a/b mount
> and the mount-listing loop in fill_mount_table inserts an entry for
> a/b.
> Later, when we search that table for the inode of "a/b", we find
> that entry and know that it's a bind-mount, so issue only the minor
> warning, rather than the "DISK CORRUPTION" warning.
> 
> With your regular mtab file, it contains no such a/b line, and
> the mount-listing loop in fill_mount_table inserts no entry for a/b.
> Later, when we search that table for a/b's inode, we find no entry
> and have to report the more serious error.
> 
> 
I don't understand why you conclude that a/b is missing in regular mtab case.
To give shorter lines easier to read
[chroot-i486] root:/usr/src/coreutils-8.20$ cd /
[chroot-i486] root:/$ mkdir -p a/b
[chroot-i486] root:/$ mount --bind a a/b
[chroot-i486] root:/$ cat /etc/mtab
/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
/a /a/b none rw,bind 0 0

I see a/b here and umount know how use that a/b entry
[chroot-i486] root:/$ umount a/b
[chroot-i486] root:/$

what is really missing?

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 21:09:02 GMT) Full text and rfc822 format available.

Message #32 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 25 Oct 2012 23:06:45 +0200
g.esp <at> free.fr wrote:

> ----- Mail original -----
>> De: "Jim Meyering" <jim <at> meyering.net>
>> À: "g esp" <g.esp <at> free.fr>
>> Cc: 12730 <at> debbugs.gnu.org
>> Envoyé: Jeudi 25 Octobre 2012 21:37:08
>> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
>>
> ...
>>
>> It sounds like you have confirmed my conclusion.
>> When you use a symlink, /etc/mtab contains a line for the a/b mount
>> and the mount-listing loop in fill_mount_table inserts an entry for
>> a/b.
>> Later, when we search that table for the inode of "a/b", we find
>> that entry and know that it's a bind-mount, so issue only the minor
>> warning, rather than the "DISK CORRUPTION" warning.
>>
>> With your regular mtab file, it contains no such a/b line, and
>> the mount-listing loop in fill_mount_table inserts no entry for a/b.
>> Later, when we search that table for a/b's inode, we find no entry
>> and have to report the more serious error.
>>
>>
> I don't understand why you conclude that a/b is missing in regular mtab case.
> To give shorter lines easier to read
> [chroot-i486] root:/usr/src/coreutils-8.20$ cd /
> [chroot-i486] root:/$ mkdir -p a/b
> [chroot-i486] root:/$ mount --bind a a/b
> [chroot-i486] root:/$ cat /etc/mtab
> /dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3
> rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
> /a /a/b none rw,bind 0 0
>
> I see a/b here and umount know how use that a/b entry
> [chroot-i486] root:/$ umount a/b
> [chroot-i486] root:/$
>
> what is really missing?

In the above, is /etc/mtab a regular file?
Can you compare the contents with those of /proc/mounts?

It might be useful to make fill_mount_table print each mnt_ent->me_devname
for which it calls hash_insert.

It sounds like the entry for a/b is being inserted when /etc/mtab
points to /proc/mounts, but not in the other case.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 25 Oct 2012 22:15:02 GMT) Full text and rfc822 format available.

Message #35 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: g.esp <at> free.fr
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Fri, 26 Oct 2012 00:11:58 +0200 (CEST)

----- Mail original -----
> De: "Jim Meyering" <jim <at> meyering.net>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12730 <at> debbugs.gnu.org
> Envoyé: Jeudi 25 Octobre 2012 23:06:45
> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
> 
> g.esp <at> free.fr wrote:
> 
...
> > I don't understand why you conclude that a/b is missing in regular
> > mtab case.
> > To give shorter lines easier to read
> > [chroot-i486] root:/usr/src/coreutils-8.20$ cd /
> > [chroot-i486] root:/$ mkdir -p a/b
> > [chroot-i486] root:/$ mount --bind a a/b
> > [chroot-i486] root:/$ cat /etc/mtab
> > /dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3
> > rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
> > /a /a/b none rw,bind 0 0
> >
> > I see a/b here and umount know how use that a/b entry
> > [chroot-i486] root:/$ umount a/b
> > [chroot-i486] root:/$
> >
> > what is really missing?
> 
> In the above, is /etc/mtab a regular file?
yes
> Can you compare the contents with those of /proc/mounts?

essentially
-/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 /a/b ext3 rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
+/a /a/b none rw,bind 0 0

> 
> It might be useful to make fill_mount_table print each
> mnt_ent->me_devname
> for which it calls hash_insert.
> 
> It sounds like the entry for a/b is being inserted when /etc/mtab
> points to /proc/mounts, but not in the other case.
> 
Yes, in that case, this line is exclude by the !mnt_ent->me_dummy condition.
The reason is that the fs value is 'none' and that qualify for the dummy list.

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Fri, 26 Oct 2012 12:00:01 GMT) Full text and rfc822 format available.

Message #38 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: g.esp <at> free.fr
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Fri, 26 Oct 2012 13:57:29 +0200
g.esp <at> free.fr wrote:
> ----- Mail original -----
>> De: "Jim Meyering" <jim <at> meyering.net>
>> À: "g esp" <g.esp <at> free.fr>
>> Cc: 12730 <at> debbugs.gnu.org
>> Envoyé: Jeudi 25 Octobre 2012 23:06:45
>> Objet: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
>>
>> g.esp <at> free.fr wrote:
>>
> ...
>> > I don't understand why you conclude that a/b is missing in regular
>> > mtab case.
>> > To give shorter lines easier to read
>> > [chroot-i486] root:/usr/src/coreutils-8.20$ cd /
>> > [chroot-i486] root:/$ mkdir -p a/b
>> > [chroot-i486] root:/$ mount --bind a a/b
>> > [chroot-i486] root:/$ cat /etc/mtab
>> > /dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3
>> > rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
>> > /a /a/b none rw,bind 0 0
>> >
>> > I see a/b here and umount know how use that a/b entry
>> > [chroot-i486] root:/$ umount a/b
>> > [chroot-i486] root:/$
>> >
>> > what is really missing?
>>
>> In the above, is /etc/mtab a regular file?
> yes
>> Can you compare the contents with those of /proc/mounts?
>
> essentially
> -/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 /a/b ext3
> rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0
> +/a /a/b none rw,bind 0 0
>
>>
>> It might be useful to make fill_mount_table print each
>> mnt_ent->me_devname
>> for which it calls hash_insert.
>>
>> It sounds like the entry for a/b is being inserted when /etc/mtab
>> points to /proc/mounts, but not in the other case.
>>
> Yes, in that case, this line is exclude by the !mnt_ent->me_dummy condition.
> The reason is that the fs value is 'none' and that qualify for the dummy list.

I'm not sure your case would be considered mainstream enough
to merit changing mountlist.[ch], but that is a possibility:

If we went that route, we'd change how me_dummy is set so that it
takes account of your case.  For example, we might add a boolean
"is_bind_mount" parameter to ME_DUMMY macro, so that when me_type is
"none" and is_bind_mount is true, ME_DUMMY would evaluate to false,
rather than to true.  The only tricky part would be robustly determining
whether "bind" is in mnt->mnt_opts.

Care to write the patch?




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 01 Nov 2012 15:28:02 GMT) Full text and rfc822 format available.

Message #41 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Warshall <warshall <at> 99main.com>
To: 12730 <at> debbugs.gnu.org
Subject: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh
Date: Thu, 1 Nov 2012 10:27:56 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi-

   I'm getting the same thing, with no chroot in the picture. That is,
   after mkdir -p a/b and mount --bind a a/b then the relevant line
   of /etc/mtab looks like

<testing dir>/a <testing dir>/a/b none rw,bind 0 0

Is having /etc/mtab a regular file really that atypical? If it helps
any, the output of "mount -V" is

mount from util-linux 2.19 (with libblkid support)

        -Andrew Warshall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQkobsAAoJEESPRWh79T7t/sUH/0jcDkuA6aAEW9gE0IVnovq1
gV/aKOAglSL3MtvzIzDYyDonl+RfDXaQE53tUbC4W1US4qw/GRGbA+ks2Uc307Qc
iyqS+l66ek0KrxUdGRYWW3/0op0U7nj0SjlkMf6wYAm+j2hDHOf2r5PwbHICpZ0g
RgJGe2K3LieoXdqltSPqscuCkv989LWtAiSl0W19w3/6FrLza6wdQlExR211MKvM
G9XAeGjaeKsErNS7c6FesMxbY0K4KZDEtHH/9yNct9RrFNrsGaKD42M+9VdzlTjO
j9/6Sw6Egn2WhH5kx4mwW1qKblwY5FKgLGRUWUzIYFWhq8KyACHsWVwyNZCf46c=
=OJDt
-----END PGP SIGNATURE-----

Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Sun, 04 Nov 2012 17:09:02 GMT) Full text and rfc822 format available.

Message #44 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Warshall <warshall <at> 99main.com>
To: 12730 <at> debbugs.gnu.org
Subject: bug #12730: patch attached
Date: Sun, 4 Nov 2012 11:08:53 -0500
[Message part 1 (text/plain, inline)]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> If we went that route, we'd change how me_dummy is set so that it
> takes account of your case.  For example, we might add a boolean
> "is_bind_mount" parameter to ME_DUMMY macro, so that when me_type is
> "none" and is_bind_mount is true, ME_DUMMY would evaluate to false,
> rather than to true.  The only tricky part would be robustly
> determining whether "bind" is in mnt->mnt_opts.
> 
> Care to write the patch?

I've attached (an attempt at) the suggested patch. It should work on
Linux/glibc, but should be tested on other platforms.

           -Andrew Warshall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQlpMVAAoJEESPRWh79T7tLTEH/jCBXk2iba986voeEJqj47Gm
ZnuYZG2Jk9m4t+AbLzijLXA3W4g3gfyVAwRj+QjTNr6WXZLZcaZ30fbp6pZh4WMz
0VNeccRc+J5iGub0M9qXWgQuG/5mDCZBqTNh3bZVZPKsFjvasjPYYRvTd6SXSQLa
oASF8NnaLw2J954q30+Gai7rfXVB+d9IhILIuuU87JfNnsxdDpLRrNvCoCwbSC2k
nhMcaRVugAh/9LO3hPcnxOlf2SUhwhYA/t3f4SXh+5nIW/wxFO0h7QN4Ra10/vxX
yzrdcrHgpNftM9Kc6kk/vStJgn94nt4DmQy/7t5o1fvdUCFxWFTGVnrTRHcJUuI=
=X46G
-----END PGP SIGNATURE-----
[coreutils-8.20-bind-mount.patch.gz (application/octet-stream, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Mon, 05 Nov 2012 01:05:02 GMT) Full text and rfc822 format available.

Message #47 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Andrew Warshall <warshall <at> 99main.com>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: bug #12730: patch attached
Date: Mon, 05 Nov 2012 02:01:53 +0100
Andrew Warshall wrote:
>> If we went that route, we'd change how me_dummy is set so that it
>> takes account of your case.  For example, we might add a boolean
>> "is_bind_mount" parameter to ME_DUMMY macro, so that when me_type is
>> "none" and is_bind_mount is true, ME_DUMMY would evaluate to false,
>> rather than to true.  The only tricky part would be robustly
>> determining whether "bind" is in mnt->mnt_opts.
>>
>> Care to write the patch?
>
> I've attached (an attempt at) the suggested patch. It should work on
> Linux/glibc, but should be tested on other platforms.

Thanks for the patch.
However, I'd rather not duplicate all of that logic solely
to change the part that deals with type-"none" entries.
Instead, I'll leave the other 5 types in a separate, new macro,
and use that from the new ME_DUMMY macro.

I've also removed the outer "#ifndef ME_DUMMY" and added
a comment and a ChangeLog entry for you.  But now,
you have to proofread that and ACK before I push it.

I've tested only on a system with MOUNTED_GETMNTENT1.

Finally, it's small enough that you don't have to fill
out copyright paperwork (hence the "tiny change"
and Copyright-paperwork-exempt notes), but if you think
you may contribute something else, please start the process now,
so the lack of an assignment does not delay things.
Let me know off-list and I'll send you the forms.


From 613bcb6205cf2b64d835c19074c5a7e7c6cb99eb Mon Sep 17 00:00:00 2001
From: Andrew Warshall <warshall <at> 99main.com>
Date: Sun, 4 Nov 2012 16:41:15 -0800
Subject: [PATCH] mountlist: do not classify a bind-mounted dir entry as
 "dummy"

* lib/mountlist.c (ME_DUMMY_0): Rename from ME_DUMMY, but omit
the "none"-testing clause.
(ME_DUMMY) [MOUNTED_GETMNTENT1]: New macro to encapsulate the
exception for bind-mounted directories.
Copyright-paperwork-exempt: Yes
---
 ChangeLog       |  8 ++++++++
 lib/mountlist.c | 31 +++++++++++++++++++++----------
 2 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 720b7a2..2173fb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-04  Andrew Warshall  <warshall <at> 99main.com>  (tiny change)
+
+	mountlist: do not classify a bind-mounted dir entry as "dummy"
+	* lib/mountlist.c (ME_DUMMY_0): Rename from ME_DUMMY, but omit
+	the "none"-testing clause.
+	(ME_DUMMY) [MOUNTED_GETMNTENT1]: New macro to encapsulate the
+	exception for bind-mounted directories.
+
 2012-11-01  Akim Demaille  <akim <at> lrde.epita.fr>

 	quote: provide a means to escape strings with nul characters
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 67154b8..a9a9f2c 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -149,16 +149,27 @@
 #undef opendir
 #undef closedir

-#ifndef ME_DUMMY
-# define ME_DUMMY(Fs_name, Fs_type)             \
-    (strcmp (Fs_type, "autofs") == 0            \
-     || strcmp (Fs_type, "none") == 0           \
-     || strcmp (Fs_type, "proc") == 0           \
-     || strcmp (Fs_type, "subfs") == 0          \
-     /* for NetBSD 3.0 */                       \
-     || strcmp (Fs_type, "kernfs") == 0         \
-     /* for Irix 6.5 */                         \
-     || strcmp (Fs_type, "ignore") == 0)
+#define ME_DUMMY_0(Fs_name, Fs_type)            \
+  (strcmp (Fs_type, "autofs") == 0              \
+   || strcmp (Fs_type, "proc") == 0             \
+   || strcmp (Fs_type, "subfs") == 0            \
+   /* for NetBSD 3.0 */                         \
+   || strcmp (Fs_type, "kernfs") == 0           \
+   /* for Irix 6.5 */                           \
+   || strcmp (Fs_type, "ignore") == 0)
+
+/* Historically, we have marked as "dummy" any file system of type "none",
+   but now that programs like du need to know about bind-mounted directories,
+   we grant an exception to any with "bind" in its list of mount options.
+   I.e., those are *not* dummy entries.  */
+#ifdef MOUNTED_GETMNTENT1
+# define ME_DUMMY(Fs_name, Fs_type, Fs_ent)	\
+  (ME_DUMMY_0 (Fs_name, Fs_type)		\
+   || (strcmp (Fs_type, "none") == 0		\
+       && !hasmntopt (Fs_ent, "bind")))
+#else
+# define ME_DUMMY(Fs_name, Fs_type)		\
+  (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
 #endif

 #ifdef __CYGWIN__
--
1.8.0




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Mon, 05 Nov 2012 01:29:02 GMT) Full text and rfc822 format available.

Message #50 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Warshall <warshall <at> 99main.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: bug #12730: patch attached
Date: Sun, 4 Nov 2012 19:28:41 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 05 Nov 2012 02:01:53 +0100
Jim Meyering <jim <at> meyering.net> wrote:
> Thanks for the patch.
> However, I'd rather not duplicate all of that logic solely
> to change the part that deals with type-"none" entries.
> Instead, I'll leave the other 5 types in a separate, new macro,
> and use that from the new ME_DUMMY macro.
> 
> I've also removed the outer "#ifndef ME_DUMMY" and added
> a comment and a ChangeLog entry for you.  But now,
> you have to proofread that and ACK before I push it.
> 
> I've tested only on a system with MOUNTED_GETMNTENT1.
> 
> Finally, it's small enough that you don't have to fill
> out copyright paperwork (hence the "tiny change"
> and Copyright-paperwork-exempt notes), but if you think
> you may contribute something else, please start the process now,
> so the lack of an assignment does not delay things.
> Let me know off-list and I'll send you the forms.
> 
> 
> From 613bcb6205cf2b64d835c19074c5a7e7c6cb99eb Mon Sep 17 00:00:00 2001
> From: Andrew Warshall <warshall <at> 99main.com>
> Date: Sun, 4 Nov 2012 16:41:15 -0800
> Subject: [PATCH] mountlist: do not classify a bind-mounted dir entry
> as "dummy"
> 
> * lib/mountlist.c (ME_DUMMY_0): Rename from ME_DUMMY, but omit
> the "none"-testing clause.
> (ME_DUMMY) [MOUNTED_GETMNTENT1]: New macro to encapsulate the
> exception for bind-mounted directories.
> Copyright-paperwork-exempt: Yes
> ---
>  ChangeLog       |  8 ++++++++
>  lib/mountlist.c | 31 +++++++++++++++++++++----------
>  2 files changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 720b7a2..2173fb2 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2012-11-04  Andrew Warshall  <warshall <at> 99main.com>  (tiny change)
> +
> +	mountlist: do not classify a bind-mounted dir entry as
> "dummy"
> +	* lib/mountlist.c (ME_DUMMY_0): Rename from ME_DUMMY, but
> omit
> +	the "none"-testing clause.
> +	(ME_DUMMY) [MOUNTED_GETMNTENT1]: New macro to encapsulate the
> +	exception for bind-mounted directories.
> +
>  2012-11-01  Akim Demaille  <akim <at> lrde.epita.fr>
> 
>  	quote: provide a means to escape strings with nul characters
> diff --git a/lib/mountlist.c b/lib/mountlist.c
> index 67154b8..a9a9f2c 100644
> --- a/lib/mountlist.c
> +++ b/lib/mountlist.c
> @@ -149,16 +149,27 @@
>  #undef opendir
>  #undef closedir
> 
> -#ifndef ME_DUMMY
> -# define ME_DUMMY(Fs_name, Fs_type)             \
> -    (strcmp (Fs_type, "autofs") == 0            \
> -     || strcmp (Fs_type, "none") == 0           \
> -     || strcmp (Fs_type, "proc") == 0           \
> -     || strcmp (Fs_type, "subfs") == 0          \
> -     /* for NetBSD 3.0 */                       \
> -     || strcmp (Fs_type, "kernfs") == 0         \
> -     /* for Irix 6.5 */                         \
> -     || strcmp (Fs_type, "ignore") == 0)
> +#define ME_DUMMY_0(Fs_name, Fs_type)            \
> +  (strcmp (Fs_type, "autofs") == 0              \
> +   || strcmp (Fs_type, "proc") == 0             \
> +   || strcmp (Fs_type, "subfs") == 0            \
> +   /* for NetBSD 3.0 */                         \
> +   || strcmp (Fs_type, "kernfs") == 0           \
> +   /* for Irix 6.5 */                           \
> +   || strcmp (Fs_type, "ignore") == 0)
> +
> +/* Historically, we have marked as "dummy" any file system of type
> "none",
> +   but now that programs like du need to know about bind-mounted
> directories,
> +   we grant an exception to any with "bind" in its list of mount
> options.
> +   I.e., those are *not* dummy entries.  */
> +#ifdef MOUNTED_GETMNTENT1
> +# define ME_DUMMY(Fs_name, Fs_type, Fs_ent)	\
> +  (ME_DUMMY_0 (Fs_name, Fs_type)		\
> +   || (strcmp (Fs_type, "none") == 0		\
> +       && !hasmntopt (Fs_ent, "bind")))
> +#else
> +# define ME_DUMMY(Fs_name, Fs_type)		\
> +  (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
>  #endif
> 
>  #ifdef __CYGWIN__
> --
> 1.8.0
> 

This looks fine. It should (I hope) have no effect on a system w/o
MOUNTED_GETMNTENT1; I was more concerned about the effect on anyone
with MOUNTED_GETMNTENT1 but without hasmntopt (i.e. a non-glibc
environment with the same getmntent semantics).

                      -Andrew Warshall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQlwg5AAoJEESPRWh79T7t4esH/3S1pACjASPJOQ656dqZQH6/
yviN1/KwSRisseyKKX1XjXgDyXnopUTDkd5irRqPFZYxjaj5xagldp4c3f0WhhFY
Kj2Ms5C1h9m4NrTodgCUW8EtfiCkBfdgj372htJHMepN0cQML5WOL+5L94VGLkWx
7EZjiXVZBYpOSjqBA8TNXogMBRurfEuOBp4nWwFgYRgfWQ1eIQS+tzbCjgigLq9a
/Kzu6i2x86ex5Bxcr421J0Lyp86T4CV7J5i3i2NcjvAgUImDLfLJRrbQFDsNhYnE
Tw9kOcTXt84AIIQSQJvB6PBZT8uTPeM8lImtDmxIw9GJNYyhd6zkPQLG6EWJrJU=
=KVEP
-----END PGP SIGNATURE-----

Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Mon, 05 Nov 2012 05:13:02 GMT) Full text and rfc822 format available.

Message #53 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Andrew Warshall <warshall <at> 99main.com>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug #12730: patch attached
Date: Mon, 05 Nov 2012 06:09:14 +0100
Andrew Warshall wrote:
...
> This looks fine.

I've pushed it to gnulib, so this bug will be fixed
in coreutils the next time it syncs from gnulib.

> It should (I hope) have no effect on a system w/o
> MOUNTED_GETMNTENT1; I was more concerned about the effect on anyone
> with MOUNTED_GETMNTENT1 but without hasmntopt (i.e. a non-glibc
> environment with the same getmntent semantics).

If someone discovers/reports that problem, we can easily write a
replacement hasmntopt function.




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 08 Nov 2012 07:06:01 GMT) Full text and rfc822 format available.

Message #56 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Andrew Warshall <warshall <at> 99main.com>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: bug #12730: patch attached
Date: Thu, 08 Nov 2012 08:05:30 +0100
Jim Meyering wrote:
> Date: Sun, 4 Nov 2012 16:41:15 -0800
> Subject: [PATCH] mountlist: do not classify a bind-mounted dir entry as
>  "dummy"
>
> * lib/mountlist.c (ME_DUMMY_0): Rename from ME_DUMMY, but omit
> the "none"-testing clause.
> (ME_DUMMY) [MOUNTED_GETMNTENT1]: New macro to encapsulate the
> exception for bind-mounted directories.
> Copyright-paperwork-exempt: Yes

Hmm.... trying the latest from gnulib, I saw a compilation failure.
And it was my fault for omitting a hunk of your patch when
I adjusted it.  Sorry about that.

Here's the fix.

From ab7a2b67b48deb4c253b3b6bd983690d71515265 Mon Sep 17 00:00:00 2001
From: Jim Meyering <jim <at> meyering.net>
Date: Wed, 7 Nov 2012 22:59:21 -0800
Subject: [PATCH] mountlist.c: fix a compilation failure

* lib/mountlist.c (read_file_system_list): Fix a compilation failure
I introduced while transforming commit v0.0-7683-g613bcb6
---
 ChangeLog       | 6 ++++++
 lib/mountlist.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index adcb8d1..1a1e8b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-07  Jim Meyering  <jim <at> meyering.net>
+
+	mountlist.c: fix a compilation failure
+	* lib/mountlist.c (read_file_system_list): Fix a compilation failure
+	I introduced while transforming commit v0.0-7683-g613bcb6
+
 2012-11-05  Paul Eggert  <eggert <at> cs.ucla.edu>

 	errno: port to LynxOS 178 2.2.2
diff --git a/lib/mountlist.c b/lib/mountlist.c
index a9a9f2c..d0fe1b2 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -430,7 +430,7 @@ read_file_system_list (bool need_fs_type)
         me->me_mountdir = xstrdup (mnt->mnt_dir);
         me->me_type = xstrdup (mnt->mnt_type);
         me->me_type_malloced = 1;
-        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
+        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt);
         me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
         me->me_dev = dev_from_mount_options (mnt->mnt_opts);

--
1.8.0




Information forwarded to bug-coreutils <at> gnu.org:
bug#12730; Package coreutils. (Thu, 08 Nov 2012 13:41:02 GMT) Full text and rfc822 format available.

Message #59 received at 12730 <at> debbugs.gnu.org (full text, mbox):

From: Andrew Warshall <warshall <at> 99main.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 12730 <at> debbugs.gnu.org
Subject: Re: bug#12730: bug #12730: patch attached
Date: Thu, 8 Nov 2012 07:44:51 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 08 Nov 2012 08:05:30 +0100
Jim Meyering <jim <at> meyering.net> wrote:

> 
> Hmm.... trying the latest from gnulib, I saw a compilation failure.
> And it was my fault for omitting a hunk of your patch when
> I adjusted it.  Sorry about that.
> 
> Here's the fix.
> 
> From ab7a2b67b48deb4c253b3b6bd983690d71515265 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <jim <at> meyering.net>
> Date: Wed, 7 Nov 2012 22:59:21 -0800
> Subject: [PATCH] mountlist.c: fix a compilation failure
> 
> * lib/mountlist.c (read_file_system_list): Fix a compilation failure
> I introduced while transforming commit v0.0-7683-g613bcb6
> ---
>  ChangeLog       | 6 ++++++
>  lib/mountlist.c | 2 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index adcb8d1..1a1e8b7 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2012-11-07  Jim Meyering  <jim <at> meyering.net>
> +
> +	mountlist.c: fix a compilation failure
> +	* lib/mountlist.c (read_file_system_list): Fix a compilation
> failure
> +	I introduced while transforming commit v0.0-7683-g613bcb6
> +
>  2012-11-05  Paul Eggert  <eggert <at> cs.ucla.edu>
> 
>  	errno: port to LynxOS 178 2.2.2
> diff --git a/lib/mountlist.c b/lib/mountlist.c
> index a9a9f2c..d0fe1b2 100644
> --- a/lib/mountlist.c
> +++ b/lib/mountlist.c
> @@ -430,7 +430,7 @@ read_file_system_list (bool need_fs_type)
>          me->me_mountdir = xstrdup (mnt->mnt_dir);
>          me->me_type = xstrdup (mnt->mnt_type);
>          me->me_type_malloced = 1;
> -        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
> +        me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt);
>          me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
>          me->me_dev = dev_from_mount_options (mnt->mnt_opts);
> 
> --
> 1.8.0
> 

I'm sorry I didn't catch it before; thanks for fixing it, in any event.

          -Andrew Warshall
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBAgAGBQJQm6lDAAoJEESPRWh79T7twWkH/3GsVTPt5stmE4pWNpxJ9vYb
ufjI4TnuTZUFPnM4xyFeZkulSsKKj+L5/GtRyaUE6O2qSk50ZGWx43jtL8PDHfMU
tu1sCT2m+4YH1JIqs6hmQMCSZpoqtXaPvIsH1nLS2mQAOLWO1KD7DvqNIrZiqrAp
UIiRcPc9bjDn0HwKLjjT2WjOhEpLf8qN/KT6gPbdtnkxl54VLPsPKzA3vm3WNWJ7
xTnWV3781vuTrsnCJ/5Hb/xGK4gQb3JK9dJlzCnQHNzepQyOT1UbxY7EH/GaSkQk
dSzXCm/vbHzWCdJ2SXc7MOVz9nNWqkhuH8by650xajzBTFr4Ssr/F84lu/BZ5Wg=
=5YA/
-----END PGP SIGNATURE-----

Added tag(s) fixed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 15 Oct 2018 17:48:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 12730 <at> debbugs.gnu.org and g.esp <at> free.fr Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 15 Oct 2018 17:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 13 Nov 2018 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 223 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.