summaryrefslogtreecommitdiff
path: root/tests/du/inacc-dir
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-07-31 10:46:31 +0200
committerJim Meyering <jim@meyering.net>2007-07-31 12:10:11 +0200
commitfd9a6e860b7f196728a975599947a09a316be260 (patch)
tree31d53da2df9076c53cb89d75cc77b37b022d7f40 /tests/du/inacc-dir
parent3b03442c5423562749982e159111782db6812b14 (diff)
downloadcoreutils-fd9a6e860b7f196728a975599947a09a316be260.tar.xz
du: print size (probably incomplete) of each inaccessible directory
* src/du.c (process_file): Print what we know of the size of a directory even when it is inaccessible. What we print is just the size of the directory itself, not counting any of its contents. * tests/du/inacc-dir: Test for this. * NEWS: Mention this change. Signed-off-by: Jim Meyering <jim@meyering.net>
Diffstat (limited to 'tests/du/inacc-dir')
-rwxr-xr-xtests/du/inacc-dir11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/du/inacc-dir b/tests/du/inacc-dir
index 3bfbdefe9..add929347 100755
--- a/tests/du/inacc-dir
+++ b/tests/du/inacc-dir
@@ -45,4 +45,15 @@ du -s a > out 2> /dev/null && fail=1
cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
+# Same as above, but don't use -s, so we print
+# an entry for the unreadable "sub", too.
+chmod 700 a/sub || fail=1
+du -k a > exp || fail=1
+chmod 0 a/sub || fail=1
+# Expect failure, ignore diagnostics.
+du -k a > out 2> /dev/null && fail=1
+
+cmp out exp || fail=1
+test $fail = 1 && diff out exp 2> /dev/null
+
(exit $fail); exit $fail