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

Ondrej Vasik ovasik at fedoraproject.org
Thu Mar 8 13:10:19 UTC 2012


commit 1618770344b123f310e3f13d6201c1f98d7d5948
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Thu Mar 8 14:10:11 2012 +0100

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

 coreutils-8.15-du-x-nondir.patch |   43 ++++++++++++++++++++++++++++++++++++++
 coreutils.spec                   |    8 ++++++-
 2 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/coreutils-8.15-du-x-nondir.patch b/coreutils-8.15-du-x-nondir.patch
new file mode 100644
index 0000000..02d120e
--- /dev/null
+++ b/coreutils-8.15-du-x-nondir.patch
@@ -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
diff --git a/coreutils.spec b/coreutils.spec
index d5ad27a..2028343 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -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 at redhat.com> 8.15-8
+- fix regression in du -x with nondir argument (by J.Meyering)
+
 * Wed Mar 07 2012 Ondrej Vasik <ovasik at redhat.com> 8.15-7
 - fix sort segfault with multibyte locales (by P.Brady)
 


More information about the scm-commits mailing list