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

From: Bernhard Voelker <[email-masked]>
Date: Sun, 02 Sep 2012 11:05:28 +0200

On 09/01/2012 05:49 PM, [email-masked] 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