Add the message when /etc/mtab is a regular file Avoid to log the case that does not apply using test -h /etc/mtab --- tests/du/bind-mount-dir-cycle.sh | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/du/bind-mount-dir-cycle.sh b/tests/du/bind-mount-dir-cycle.sh index d8d381a..79fdf61 100755 --- a/tests/du/bind-mount-dir-cycle.sh +++ b/tests/du/bind-mount-dir-cycle.sh @@ -33,12 +33,21 @@ mount --bind a a/b \ || skip_ "This test requires mount with a working --bind option." echo a > exp || framework_failure_ -echo "du: mount point 'a/b' already traversed" > exp-err || framework_failure_ +echo "du: mount point 'a/b' already traversed" > exp-err-mtab-symlink || framework_failure_ +cat <<EOF > exp-err-mtab-regular || framework_failure_ +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' + +EOF du a > out 2> err && fail=1 sed 's/^[0-9][0-9]* //' out > k && mv k out -compare exp-err err || fail=1 +env test -h /etc/mtab && (compare exp-err-mtab-symlink err || fail=1) +env test -h /etc/mtab || compare exp-err-mtab-regular err || fail=1 compare exp out || fail=1 Exit $fail -- 1.7.2.5
