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

From: Jim Meyering <[email-masked]>
Date: Thu, 25 Oct 2012 14:19:12 +0200

[email-masked] 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 <[email-masked]>
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