1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-16 20:33:18 +02:00

Adapt du's no-x test not to fail on older Linux systems.

* tests/du/no-x: Accept a third variant of the diagnostic.
This commit is contained in:
Jim Meyering
2007-08-02 18:52:40 +02:00
parent fd9a6e860b
commit df03463679
2 changed files with 18 additions and 16 deletions

View File

@@ -1,3 +1,8 @@
2007-08-02 Jim Meyering <jim@meyering.net>
Adapt du's no-x test not to fail on older Linux systems.
* tests/du/no-x: Accept a third variant of the diagnostic.
2007-07-31 Jim Meyering <jim@meyering.net>
du: print size (probably incomplete) of each inaccessible directory

View File

@@ -2,7 +2,7 @@
# Make sure du gives the right diagnostic for a readable,
# but inaccessible directory.
# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -46,25 +46,22 @@ fail=0
# This must exit nonzero.
du d >/dev/null 2>out && fail=1
# Depending on whether du/fts is using native fdopendir, we see one
# of the following diagnostics (note also the /y suffix in one case):
# du: `d/no-x': Permission denied
# du: cannot access `d/no-x/y': Permission denied
# du: cannot read directory `d/no-x': Permission denied
# Convert either of the latter two to the first one.
sed 's/^du: cannot access /du: /' out > t && mv t out
sed 's/^du: cannot read directory /du: /' out > t && mv t out
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
cat <<\EOF > exp
du: `d/no-x': Permission denied
EOF
# With native fdopendir, du uses a different code path.
cat <<\EOF > exp-native-fdopendir
du: cannot access `d/no-x/y': Permission denied
EOF
if cmp out exp >/dev/null 2>&1; then
:
else
if cmp out exp-native-fdopendir; then
:
else
fail=1
fi
fi
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail