diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-12-14 18:00:42 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-12-14 18:04:05 -0800 |
commit | cfe1040c093be1c1a9b2403e713f1d1c2242a4bc (patch) | |
tree | 14de0a5fc39a117ea2d44e5cb297475585eb22fa /tests/du | |
parent | 021a0664093506394fd8ee0a789ebfe6e6b69deb (diff) | |
download | coreutils-cfe1040c093be1c1a9b2403e713f1d1c2242a4bc.tar.xz |
du: -x should not count files in other file systems
This fixes Bug#10293, which I guess was introduced in commit
95c948b06a dated 2003-10-02.
* NEWS: Document fix.
* src/du.c (process_file): Don't count files in different file
systems if -x is given.
* tests/du/one-file-system: Test for this bug.
Diffstat (limited to 'tests/du')
-rwxr-xr-x | tests/du/one-file-system | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/du/one-file-system b/tests/du/one-file-system index 7195838bd..3e82a8d45 100755 --- a/tests/du/one-file-system +++ b/tests/du/one-file-system @@ -1,6 +1,5 @@ #!/bin/sh -# Test for a bug in fts's handling of FTS_XDEV, the flag behind -# du's --one-file-system (-x) option. +# Test for bugs in du's --one-file-system (-x) option. # Copyright (C) 2006-2011 Free Software Foundation, Inc. @@ -19,9 +18,11 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ du +cleanup_() { rm -rf "$other_partition_tmpdir"; } +. "$abs_srcdir/other-fs-tmpdir" -mkdir -p b/c y/z || framework_failure_ - +mkdir -p b/c y/z d "$other_partition_tmpdir/x" || framework_failure_ +ln -s "$other_partition_tmpdir/x" d || framework_failure_ # Due to a used-uninitialized variable, the "du -x" from coreutils-6.6 # would not traverse into second and subsequent directories listed @@ -37,4 +38,12 @@ EOF compare exp out || fail=1 +# "du -xL" reported a zero count for a file in a different file system, +# instead of ignoring it. +du -xL d > u || fail=1 +sed 's/^[0-9][0-9]* //' u > out1 +echo d > exp1 || fail=1 + +compare exp1 out1 || fail=1 + Exit $fail |