fix regression in du -x with nondir argument (thans D.Stavrovski and J.Meyering)

This commit is contained in:
Ondřej Vašík 2012-03-08 14:10:11 +01:00
parent 58683bf9af
commit 1618770344
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,43 @@
diff --git a/src/du.c b/src/du.c
index e4e36df..41c9535 100644
--- a/src/du.c
+++ b/src/du.c
@@ -443,7 +443,14 @@ process_file (FTS *fts, FTSENT *ent)
return false;
}
- if (fts->fts_options & FTS_XDEV && fts->fts_dev != sb->st_dev)
+ /* The --one-file-system (-x) option cannot exclude anything
+ specified on the command-line. By definition, it can exclude
+ a file or directory only when its device number is different
+ from that of its just-processed parent directory, and du does
+ not process the parent of a command-line argument. */
+ if (fts->fts_options & FTS_XDEV
+ && FTS_ROOTLEVEL < ent->fts_level
+ && fts->fts_dev != sb->st_dev)
excluded = true;
}
diff --git a/tests/du/one-file-system b/tests/du/one-file-system
index f0d264a..110080f 100755
--- a/tests/du/one-file-system
+++ b/tests/du/one-file-system
@@ -43,7 +43,15 @@ compare exp out || fail=1
du -xL d > u || fail=1
sed 's/^[0-9][0-9]* //' u > out1
echo d > exp1 || fail=1
-
compare exp1 out1 || fail=1
+# With coreutils-8.15, "du -xs FILE" would print no output.
+touch f
+for opt in -x -xs; do
+ du $opt f > u || fail=1
+ sed 's/^[0-9][0-9]* //' u > out2
+ echo f > exp2 || fail=1
+ compare exp2 out2 || fail=1
+done
+
Exit $fail
--
cgit v0.9.0.2

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.15
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@ -18,6 +18,8 @@ Source202: coreutils-su-l.pamd
Source203: coreutils-runuser-l.pamd
# From upstream
# fix regression in du -x with nondir argument
Patch1: coreutils-8.15-du-x-nondir.patch
# Our patches
#general patch to workaround koji build system issues
@ -143,6 +145,7 @@ the old GNU fileutils, sh-utils, and textutils packages.
%setup -q
# From upstream
%patch1 -p1 -b .xnondir
# Our patches
%patch100 -p1 -b .configure
@ -416,6 +419,9 @@ fi
%{?!norunuser:%{_sbindir}/runuser}
%changelog
* Thu Mar 08 2012 Ondrej Vasik <ovasik@redhat.com> 8.15-8
- fix regression in du -x with nondir argument (by J.Meyering)
* Wed Mar 07 2012 Ondrej Vasik <ovasik@redhat.com> 8.15-7
- fix sort segfault with multibyte locales (by P.Brady)