Subject: Re: bug#12322: coreutils-8.1{8, 9} with /etc/mtab as real file, df/total-unprocessed fail, df/no-mtab-status is skipped

From: [email-masked]
Date: Sun, 30 Sep 2012 10:29:33 +0200 (CEST)

----- Mail original -----
De: "g esp" <[email-masked]>
À: "Bernhard Voelker" <[email-masked]>
Cc: [email-masked]
Envoyé: Lundi 3 Septembre 2012 00:07:26
Objet: bug#12322: coreutils-8.1{8, 9} with /etc/mtab as real file,	df/total-unprocessed fail, df/no-mtab-status is skipped

----- Mail original -----
> De: "Bernhard Voelker" <[email-masked]>
> À: "g esp" <[email-masked]>
> Cc: [email-masked]
> Envoyé: Dimanche 2 Septembre 2012 11:05:28
> Objet: bug#12322: coreutils-8.1{8, 9} with /etc/mtab as real file,	df/total-unprocessed fail, df/no-mtab-status is
> skipped
> 

I fixed how /etc/mtab is filled inside my chroot using
	# Use mtab as regular file. This allow 'df' not to fail during coreutils test with mount points out
	# of the chroot that didn't exist inside (like debian /lib/init/rw)
	rm -f /etc/mtab		# In case you experiment with symlink to /proc/mounts
	# rootfs need to be on top of file or df -T -t <yourfstype> / will fail with df: no file systems processed
	grep ' / ' /proc/mounts >/etc/mtab
	# Remove the duplicate due to the mount --bind
	grep -E '/sys sysfs|/proc proc|/dev/pts|/dev/shm' /proc/mounts | sort -u >>/etc/mtab

So without changing coreutils test suite (except separate issue with test-getlogin.c isatty), tests look better

Using a correct /etc/mtab, that changed unobviously those results (as they bot use df)
-skip-seek-past-dev: skipped test: failed to determine size of -
-SKIP: dd/skip-seek-past-dev
+PASS: dd/skip-seek-past-dev

-slink: skipped test: '.' is on an XFS file system
-SKIP: du/slink
+PASS: du/slink

I was always suspicious about '.' is on an XFS file system as / is ext3 on this machine.

cp/fiemap-perf is the test that fail when on /etc/mtab, rootfs is after the /dev with / partition.
[chroot-i486] root:/$ grep ' / ' /proc/mounts | sort >/etc/mtab
[chroot-i486] root:/$ cat /etc/mtab
/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 / ext3 rw,relatime,errors=remount-ro,data=ordered 0 0
rootfs / rootfs rw 0 0
[chroot-i486] root:/$ df -T -t ext2 -t ext3 . && echo should skip with ext3
df: no file systems processed
[chroot-i486] root:/$ df -T  && echo done
Filesystem     Type   1K-blocks     Used Available Use% Mounted on
/dev/sda3      ext3    19228308 14717448   3534108  81% /
rootfs         rootfs  19228308 14717448   3534108  81% /
done

Should not some df tests be added that warn on malformed /etc/mtab?

As a notice, util-linux-2.22 libmount code may let some stray loops after coreutils tests have run with regular /etc/mtab and a running kernel before 2.6.37, git version of util-linux is fixed.

Gilles