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

Previous Next

Package: coreutils;

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

Date: Sat, 1 Sep 2012 15:51:02 UTC

Severity: normal

To reply to this bug, email your comments to 12322 AT debbugs.gnu.org.

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#12322; Package coreutils. (Sat, 01 Sep 2012 15:51: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. (Sat, 01 Sep 2012 15:51: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.1{8,9} with /etc/mtab as real file,
	df/total-unprocessed fail, df/no-mtab-status is skipped
Date: Sat, 1 Sep 2012 17:49:22 +0200 (CEST)
On the 8.0 era, I had to switch from /etc/mtab symlinked to /proc/mounts to a real /etc/mtab or one cu test fail to umount

Now depending of /etc/mtab nature, I see 2 df tests behaving differently on my linux chroot used to build

When not using /etc/mtab as symlink
df '.' does not report the intended 'no file systems processed' for total-unprocessed test and that test fail
but df with no parameter report 'no file systems processed' and an error, so df/no-mtab-status is skipped

When using /etc/mtab as symlink to /proc/mounts
df '.' report the intended 'no file systems processed' for total-unprocessed script and test pass
but df with no parameter can't read mount point existing out of chroot and df/no-mtab-status is skipped again

The log that FAIL with real /etc/mtab is as follow

FAIL: df/total-unprocessed
==========================

++ initial_cwd_=/usr/src/coreutils-8.19/tests
++ fail=0
+++ testdir_prefix_
+++ printf gt
++ pfx_=gt
+++ mktempd_ /usr/src/coreutils-8.19/tests gt-total-unprocessed.XXXX
+++ case $# in
+++ destdir_=/usr/src/coreutils-8.19/tests
+++ template_=gt-total-unprocessed.XXXX
+++ MAX_TRIES_=4
+++ case $destdir_ in
+++ case $template_ in
++++ unset TMPDIR
+++ d=/usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
+++ case $d in
+++ test -d /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
++++ tr S -
++++ ls -dgo /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
+++ perms='drwx------ 2 4096 Aug 29 00:17 /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2'
+++ case $perms in
+++ test 0 = 0
+++ echo /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
+++ return
++ test_dir_=/usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
++ cd /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
++ gl_init_sh_nl_='
'
++ IFS=' 	
'
++ for sig_ in 1 2 3 13 15
+++ expr 1 + 128
++ eval 'trap '\''Exit 129'\'' 1'
+++ trap 'Exit 129' 1
++ for sig_ in 1 2 3 13 15
+++ expr 2 + 128
++ eval 'trap '\''Exit 130'\'' 2'
+++ trap 'Exit 130' 2
++ for sig_ in 1 2 3 13 15
+++ expr 3 + 128
++ eval 'trap '\''Exit 131'\'' 3'
+++ trap 'Exit 131' 3
++ for sig_ in 1 2 3 13 15
+++ expr 13 + 128
++ eval 'trap '\''Exit 141'\'' 13'
+++ trap 'Exit 141' 13
++ for sig_ in 1 2 3 13 15
+++ expr 15 + 128
++ eval 'trap '\''Exit 143'\'' 15'
+++ trap 'Exit 143' 15
++ trap remove_tmp_ 0
+ path_prepend_ ../src
+ test 1 '!=' 0
+ path_dir_=../src
+ case $path_dir_ in
+ abs_path_dir_=/usr/src/coreutils-8.19/tests/../src
+ case $abs_path_dir_ in
+ PATH=/usr/src/coreutils-8.19/tests/../src:/usr/src/coreutils-8.19/src:/bin:/usr/bin:/sbin:/usr/sbin
+ create_exe_shims_ /usr/src/coreutils-8.19/tests/../src
+ case $EXEEXT in
+ return 0
+ shift
+ test 0 '!=' 0
+ export PATH
+ print_ver_ df
+ test yes = yes
+ local i
+ for i in '$*'
+ env df --version
df (GNU coreutils) 8.19
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Paul Eggert.
+ require_mount_list_
+ local 'mount_list_fail=cannot read table of mounted file systems'
+ grep -F 'cannot read table of mounted file systems'
+ df
+ cat
+ df --local -t nfs --total .
Filesystem     1K-blocks     Used Available Use% Mounted on
-               19228308 16776508   1475048  92% /
total           19228308 16776508   1475048  92%
+ 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
--- exp	2012-08-29 00:17:31.000000000 +0200
+++ out	2012-08-29 00:17:31.000000000 +0200
@@ -1 +0,0 @@
-df: no file systems processed
+ fail=1
+ cat
+ df --total _does_not_exist_
+ 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_
+ :
+ cd /usr/src/coreutils-8.19/tests
+ chmod -R u+rwx /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
+ rm -rf /usr/src/coreutils-8.19/tests/gt-total-unprocessed.CId2
+ exit 1

With real /etc/mtab, (on my chroot, there is many mount --bind before to enter the chroot)
[chroot-i486] root:/$ mount
/dev on /dev type none (rw)
[chroot-i486] root:/$ df
df: no file systems processed
[chroot-i486] root:/$ ln -sf /proc/mounts /etc/mtab
[chroot-i486] root:/$ mount
rootfs on / type rootfs (rw)
none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
none on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /dev type devtmpfs (rw,relatime,size=512760k,nr_inodes=128190,mode=755)
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8 on / type ext3 (rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,relatime,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
...
[chroot-i486] root:/$ df
df: '/lib/init/rw': No such file or directory
Filesystem     1K-blocks     Used Available Use% Mounted on
rootfs          19228308 15796388   2455168  87% /
none              512760      156    512604   1% /dev
/dev/sda3       19228308 15796388   2455168  87% /
tmpfs             517208        0    517208   0% /dev/shm
/dev/sda1       19228308 15796388   2455168  87% /boot
none              512760      156    512604   1% /dev
tmpfs             517208        0    517208   0% /dev/shm
...

So df/no-mtab-status is skipped in both case because df returned an error while reading /lib/init/rw that is out of chroot.

Maybe both tests could check if /etc/mtab is a symlink and adjust df parameter to not fail?

I made this change on the tests to see if that work
	cd $(DIR_APP) && sed -i "s/ '\.' / /" tests/df/total-unprocessed
	cd $(DIR_APP) && sed -i "s/df ||/df '.' ||/" tests/df/no-mtab-status

With /etc/mtab as a real file, both tests passed

Gilles








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

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: g.esp <at> free.fr
Cc: 12322 <at> debbugs.gnu.org
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
Date: Sun, 02 Sep 2012 11:05:28 +0200
On 09/01/2012 05:49 PM, g.esp <at> free.fr wrote:
> Maybe both tests could check if /etc/mtab is a symlink and adjust df parameter to not fail?
> 
> I made this change on the tests to see if that work
> 	cd $(DIR_APP) && sed -i "s/ '\.' / /" tests/df/total-unprocessed
> 	cd $(DIR_APP) && sed -i "s/df ||/df '.' ||/" tests/df/no-mtab-status
> 
> With /etc/mtab as a real file, both tests passed

Thank you for the report.

To make it clear, your change suggests this:

diff --git a/tests/df/no-mtab-status.sh b/tests/df/no-mtab-status.sh
index e434f5f..6d19f8b 100755
--- a/tests/df/no-mtab-status.sh
+++ b/tests/df/no-mtab-status.sh
@@ -20,7 +20,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
 print_ver_ df

-df || skip_ "df fails"
+df '.' || skip_ "df fails"

 # Simulate "mtab" failure.
 cat > k.c <<'EOF' || framework_failure_
diff --git a/tests/df/total-unprocessed.sh b/tests/df/total-unprocessed.sh
index aa49836..dbe552e5 100755
--- a/tests/df/total-unprocessed.sh
+++ b/tests/df/total-unprocessed.sh
@@ -28,7 +28,7 @@ EOF
 # The following simply finds no match for the combination
 # of the options --local and FS-type nfs together with the
 # argument ".". It must exit non-Zero nonetheless.
-df --local -t nfs --total '.' 2>out && fail=1
+df --local -t nfs --total 2>out && fail=1
 compare exp out || fail=1

 cat <<\EOF > exp || framework_failure_


Additionally to a missing mtab, there is another reason which
can make df fail: an inaccessible mount point, e.g. when there's
a file system mounted on /root/backup which is not accessible
by a normal user.

The above tests provoke certain error conditions:
no-mtab-status tests df's behaviour when the mtab cannot be read;
total-unprocessed tests that df exits non-Zero and writes an error
message when --total is used but no file system has been processed.

While your change doesn't make the tests skip under certain
conditions, it well may trigger a different than the intended
failure. E.g. in no-mtab-status, there's a test which is supposed
to fail because we simulated the mtab failure:

  # These tests are supposed to fail:
  LD_PRELOAD=./k.so df && fail=1

That command - a simple df without arguments - could also fail due
to another reason (see above), so the failure may shadow the expected
failure from (simulated) missing mtab.

That said, I'd rather skip a test that cannot otherwise guarantee
why it fails/succeeds.

Have a nice day,
Berny





Information forwarded to bug-coreutils <at> gnu.org:
bug#12322; Package coreutils. (Sun, 02 Sep 2012 22:10:02 GMT) Full text and rfc822 format available.

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

From: g.esp <at> free.fr
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 12322 <at> debbugs.gnu.org
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
Date: Mon, 3 Sep 2012 00:07:26 +0200 (CEST)

----- Mail original -----
> De: "Bernhard Voelker" <mail <at> bernhard-voelker.de>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12322 <at> debbugs.gnu.org
> 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
> 
> On 09/01/2012 05:49 PM, g.esp <at> free.fr wrote:
> > Maybe both tests could check if /etc/mtab is a symlink and adjust
> > df parameter to not fail?
> > 
> > I made this change on the tests to see if that work
> > 	cd $(DIR_APP) && sed -i "s/ '\.' / /" tests/df/total-unprocessed
> > 	cd $(DIR_APP) && sed -i "s/df ||/df '.' ||/"
> > 	tests/df/no-mtab-status
> > 
> > With /etc/mtab as a real file, both tests passed
> 
> Thank you for the report.
> 
> To make it clear, your change suggests this:
> 
> diff --git a/tests/df/no-mtab-status.sh b/tests/df/no-mtab-status.sh
> index e434f5f..6d19f8b 100755
> --- a/tests/df/no-mtab-status.sh
> +++ b/tests/df/no-mtab-status.sh
> @@ -20,7 +20,7 @@
>  . "${srcdir=.}/init.sh"; path_prepend_ ../src
>  print_ver_ df
> 
> -df || skip_ "df fails"
> +df '.' || skip_ "df fails"
> 
>  # Simulate "mtab" failure.
>  cat > k.c <<'EOF' || framework_failure_
> diff --git a/tests/df/total-unprocessed.sh
> b/tests/df/total-unprocessed.sh
> index aa49836..dbe552e5 100755
> --- a/tests/df/total-unprocessed.sh
> +++ b/tests/df/total-unprocessed.sh
> @@ -28,7 +28,7 @@ EOF
>  # The following simply finds no match for the combination
>  # of the options --local and FS-type nfs together with the
>  # argument ".". It must exit non-Zero nonetheless.
> -df --local -t nfs --total '.' 2>out && fail=1
> +df --local -t nfs --total 2>out && fail=1
>  compare exp out || fail=1
> 
>  cat <<\EOF > exp || framework_failure_
> 
> 
Yes that should fix df/total-unprocessed.sh and df/total-unprocessed.sh in both /etc/mtab cases.

> Additionally to a missing mtab, there is another reason which
> can make df fail: an inaccessible mount point, e.g. when there's
> a file system mounted on /root/backup which is not accessible
> by a normal user.
> 
> The above tests provoke certain error conditions:
> no-mtab-status tests df's behaviour when the mtab cannot be read;
> total-unprocessed tests that df exits non-Zero and writes an error
> message when --total is used but no file system has been processed.
> 
> While your change doesn't make the tests skip under certain
> conditions, it well may trigger a different than the intended
> failure. E.g. in no-mtab-status, there's a test which is supposed
> to fail because we simulated the mtab failure:
> 
>   # These tests are supposed to fail:
>   LD_PRELOAD=./k.so df && fail=1
> 
> That command - a simple df without arguments - could also fail due
> to another reason (see above), so the failure may shadow the expected
> failure from (simulated) missing mtab.
> 
> That said, I'd rather skip a test that cannot otherwise guarantee
> why it fails/succeeds.
> 
> Have a nice day,
> Berny
> 
Yes here df command fail in real /etc/mtab case, so even if this test will not trigger for the intented reason, test will not fail.

Similary total-verify.sh may be fixed to pass in /etc/mtab real file case with this patch (hope nothing will be wrapped)
diff --git a/tests/df/total-verify.sh b/tests/df/total-verify.sh
index 948b002..317cb75 100755
--- a/tests/df/total-verify.sh
+++ b/tests/df/total-verify.sh
@@ -20,7 +20,7 @@
 print_ver_ df
 require_perl_

-df || skip_ "df fails"
+df '.' || skip_ "df fails"

 cat <<\EOF > check-df || framework_failure_
 my ($total, $used, $avail) = (0, 0, 0);
@@ -53,9 +53,9 @@ EOF

 # Use --block-size=512 to keep df from printing rounded-to-kilobyte
 # numbers which wouldn't necessarily add up to the displayed total.
-df --total -P --block-size=512 > space || framework_failure_
+df --total -P --block-size=512 '.' > space || framework_failure_
 cat space  # this helps when debugging any test failure
-df --total -i -P               > inode || framework_failure_
+df --total -i -P               '.' > inode || framework_failure_
 cat inode

 $PERL check-df space || fail=1

Gilles




Information forwarded to bug-coreutils <at> gnu.org:
bug#12322; Package coreutils. (Sun, 30 Sep 2012 08:31:01 GMT) Full text and rfc822 format available.

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

From: g.esp <at> free.fr
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 12322 <at> debbugs.gnu.org
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
Date: Sun, 30 Sep 2012 10:29:33 +0200 (CEST)

----- Mail original -----
De: "g esp" <g.esp <at> free.fr>
À: "Bernhard Voelker" <mail <at> bernhard-voelker.de>
Cc: 12322 <at> debbugs.gnu.org
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" <mail <at> bernhard-voelker.de>
> À: "g esp" <g.esp <at> free.fr>
> Cc: 12322 <at> debbugs.gnu.org
> 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




This bug report was last modified 12 years and 268 days ago.

Previous Next


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