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 18:22:21 +0200

[email-masked] wrote:
> ----- Mail original -----
>> De: "Jim Meyering" <[email-masked]>
>> À: "g esp" <[email-masked]>
>> Cc: [email-masked]
>> 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?