From 2e683ab4ebe2580dde661e51b68b22f5d02dcc59be832a140eecc134fd6f7f3f Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 30 Jan 2015 05:02:35 +0000 Subject: [PATCH] Accepting request 282919 from Base:System Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/282919 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=108 --- ...root-perform-chdir-unless-skip-chdir.patch | 10 +- ...df-a-includes-duplicate-file-systems.patch | 65 +++++ ...ils-df-improve-mount-point-selection.patch | 67 +++++ ...tils-df-show-all-remote-file-systems.patch | 70 +++++ ...s-df-total-suppress-separate-remotes.patch | 250 ++++++++++++++++++ ...ify-rotate-more-robust-and-efficient.patch | 11 +- coreutils-testsuite.changes | 17 ++ coreutils-testsuite.spec | 13 +- coreutils.changes | 17 ++ coreutils.spec | 13 +- 10 files changed, 519 insertions(+), 14 deletions(-) create mode 100644 coreutils-df-doc-df-a-includes-duplicate-file-systems.patch create mode 100644 coreutils-df-improve-mount-point-selection.patch create mode 100644 coreutils-df-show-all-remote-file-systems.patch create mode 100644 coreutils-df-total-suppress-separate-remotes.patch diff --git a/coreutils-chroot-perform-chdir-unless-skip-chdir.patch b/coreutils-chroot-perform-chdir-unless-skip-chdir.patch index ff7315b..0925cd5 100644 --- a/coreutils-chroot-perform-chdir-unless-skip-chdir.patch +++ b/coreutils-chroot-perform-chdir-unless-skip-chdir.patch @@ -76,7 +76,7 @@ Index: NEWS =================================================================== --- NEWS.orig +++ NEWS -@@ -172,6 +172,19 @@ GNU coreutils NEWS +@@ -180,6 +180,19 @@ GNU coreutils NEWS --format=%T now reports the file system type, and tail -f now uses inotify, rather than the default of issuing a warning and reverting to polling. @@ -100,7 +100,7 @@ Index: doc/coreutils.texi =================================================================== --- doc/coreutils.texi.orig +++ doc/coreutils.texi -@@ -16068,7 +16068,10 @@ On many systems, only the super-user can +@@ -16074,7 +16074,10 @@ On many systems, only the super-user can some systems (e.g., FreeBSD) can be configured to allow certain regular users to use the @code{chroot} system call, and hence to run this program. Also, on Cygwin, anyone can run the @command{chroot} command, because the @@ -112,7 +112,7 @@ Index: doc/coreutils.texi Synopses: @example -@@ -16078,10 +16081,11 @@ chroot @var{option} +@@ -16084,10 +16087,11 @@ chroot @var{option} Ordinarily, file names are looked up starting at the root of the directory structure, i.e., @file{/}. @command{chroot} changes the root to @@ -128,7 +128,7 @@ Index: doc/coreutils.texi @var{command} must not be a special built-in utility (@pxref{Special built-in utilities}). -@@ -16090,6 +16094,14 @@ Options must precede operands. +@@ -16096,6 +16100,14 @@ Options must precede operands. @table @samp @@ -143,7 +143,7 @@ Index: doc/coreutils.texi @item --userspec=@var{user}[:@var{group}] @opindex --userspec By default, @var{command} is run with the same credentials -@@ -16100,13 +16112,13 @@ If a @var{user} is specified then the su +@@ -16106,13 +16118,13 @@ If a @var{user} is specified then the su are set according to the system defined list for that user, unless overridden with the @option{--groups} option. diff --git a/coreutils-df-doc-df-a-includes-duplicate-file-systems.patch b/coreutils-df-doc-df-a-includes-duplicate-file-systems.patch new file mode 100644 index 0000000..b1caebd --- /dev/null +++ b/coreutils-df-doc-df-a-includes-duplicate-file-systems.patch @@ -0,0 +1,65 @@ +Upstream patch for df(1) on top of v8.23, to be removed with v8.24. +http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=097897bd2c9d + +From 097897bd2c9de5723af24b3848d6d922a862064b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Mon, 27 Oct 2014 11:41:09 +0000 +Subject: [PATCH] doc: mention that df -a includes duplicate file systems + +* src/df.c (usage): Mention that duplicate file systems are shown +with this option, not just dummy file systems. +* doc/coreutils.texi (df invocation): For the --all option, expand +on the class of normally suppressed mount entries that it includes. + +Reported in http://bugs.debian.org/737399 +--- + doc/coreutils.texi | 12 ++++++++---- + src/df.c | 4 ++-- + 2 files changed, 10 insertions(+), 6 deletions(-) + +Index: doc/coreutils.texi +=================================================================== +--- doc/coreutils.texi.orig ++++ doc/coreutils.texi +@@ -11184,11 +11184,15 @@ The program accepts the following option + @itemx --all + @opindex -a + @opindex --all +-@cindex automounter file systems + @cindex ignore file systems +-Include in the listing dummy file systems, which +-are omitted by default. Such file systems are typically special-purpose +-pseudo-file-systems, such as automounter entries. ++Include in the listing dummy, duplicate, or inaccessible file systems, which ++are omitted by default. Dummy file systems are typically special purpose ++pseudo file systems such as @samp{/proc}, with no associated storage. ++Duplicate file systems are local or remote file systems that are mounted ++at separate locations in the local file hierarchy, or bind mounted locations. ++Inaccessible file systems are those which are mounted but subsequently ++over-mounted by another file system at that point, or otherwise inaccessible ++due to permissions of the mount point etc. + + @item -B @var{size} + @itemx --block-size=@var{size} +Index: src/df.c +=================================================================== +--- src/df.c.orig ++++ src/df.c +@@ -648,7 +648,7 @@ filter_mount_list (bool devices_only) + > strlen (me->me_mountdir)) + /* let an entry overmounted on a different device win... */ + || (! STREQ (devlist->me->me_devname, me->me_devname) +- /* ... but only when matching an exsiting mount point, to ++ /* ... but only when matching an existing mount point, to + avoid problematic replacement when given inaccurate mount + lists, seen with some chroot environments for example. */ + && STREQ (me->me_mountdir, devlist->me->me_mountdir))) +@@ -1396,7 +1396,7 @@ or all file systems by default.\n\ + /* TRANSLATORS: The thousands and decimal separators are best + adjusted to an appropriate default for your locale. */ + fputs (_("\ +- -a, --all include dummy file systems\n\ ++ -a, --all include pseudo, duplicate, inaccessible file systems\n\ + -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ + '-BM' prints sizes in units of 1,048,576 bytes;\n\ + see SIZE format below\n\ diff --git a/coreutils-df-improve-mount-point-selection.patch b/coreutils-df-improve-mount-point-selection.patch new file mode 100644 index 0000000..c92b2c7 --- /dev/null +++ b/coreutils-df-improve-mount-point-selection.patch @@ -0,0 +1,67 @@ +Upstream patch for df(1) on top of v8.23, to be removed with v8.24. +http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=ed1a495b3ccb + +From ed1a495b3ccb2665a13229ca866f2115bd768d17 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Mon, 18 Aug 2014 17:59:26 +0100 +Subject: [PATCH] df: improve mount point selection with inaccurate mount list + +v8.23 has a test failure on Fedora rawhide build servers +in tests/df/skip-duplicate.sh. This was due to no '/' +entry being output by df. That was due to an inaccurate +/proc/mounts on the build environment as stat(/mnt/point) +identified all these /proc/mounts entries as having the +same device id: + + / rootfs + / /dev/md1 + /dev devtmpfs + /run tmpfs + /boot /dev/md0 + /proc/filesystems /dev/md1 + +Since the device name on the right changes for a given id, +that causes the entries to be continually replaced, thus +resulting in no '/' entry. I'm guessing this is due to +the mock environment bind mounting unneeded or sensitive +items to a dummy file on the host / (/dev/md1) though +have not looked into those details. + +So rather than relying on an accurate /proc/mounts, +the attached patch takes a more conservative replacement +approach and only swaps a new device entry when the +mount point matches. That should handle all practical +cases while also avoiding this situation. + +* src/df.c (filter_mount_list): Only replace entries with +different device names when the mount point also matches. +--- + src/df.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +Index: src/df.c +=================================================================== +--- src/df.c.orig ++++ src/df.c +@@ -640,13 +640,18 @@ filter_mount_list (bool devices_only) + + if (devlist) + { +- /* ...let the shorter mountdir win. */ ++ /* let "real" devices with '/' in the name win. */ + if ((strchr (me->me_devname, '/') + && ! strchr (devlist->me->me_devname, '/')) ++ /* let a shorter mountdir win. */ + || (strlen (devlist->me->me_mountdir) + > strlen (me->me_mountdir)) +- /* or one overmounted on a different device. */ +- || ! STREQ (devlist->me->me_devname, me->me_devname)) ++ /* let an entry overmounted on a different device win... */ ++ || (! STREQ (devlist->me->me_devname, me->me_devname) ++ /* ... but only when matching an exsiting mount point, to ++ avoid problematic replacement when given inaccurate mount ++ lists, seen with some chroot environments for example. */ ++ && STREQ (me->me_mountdir, devlist->me->me_mountdir))) + { + /* Discard mount entry for existing device. */ + discard_me = devlist->me; diff --git a/coreutils-df-show-all-remote-file-systems.patch b/coreutils-df-show-all-remote-file-systems.patch new file mode 100644 index 0000000..7331cc8 --- /dev/null +++ b/coreutils-df-show-all-remote-file-systems.patch @@ -0,0 +1,70 @@ +Upstream patch for df(1) on top of v8.23, to be removed with v8.24. +http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=3ab3c7bb24b8 + +From 3ab3c7bb24b86ef2d2fede9fe26e3ee585db5411 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Mon, 27 Oct 2014 23:37:08 +0000 +Subject: [PATCH] df: ensure -a shows all remote file system entries + +commit v8.22-125-g9d736f8 printed placeholder "-" values +for device names that didn't match the preferred device name +for a particular mount point. However that was seen to erroneously +suppress values for aliased host names or exports, common with +remote file systems. + +* src/df.c (me_for_dev): Rename from devname_for_dev() so that +we can determine the remoteness as well as the name for the +preferred mount entry. +(get_dev): Don't output place holder values when both +current and preferred mount entries are remote. + +Reported in http://bugs.debian.org/737399 +--- + src/df.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +Index: src/df.c +=================================================================== +--- src/df.c.orig ++++ src/df.c +@@ -703,17 +703,17 @@ filter_mount_list (bool devices_only) + } + + /* Search a mount entry list for device id DEV. +- Return the corresponding device name if found or NULL if not. */ ++ Return the corresponding mount entry if found or NULL if not. */ + +-static char const * _GL_ATTRIBUTE_PURE +-devname_for_dev (dev_t dev) ++static struct mount_entry const * _GL_ATTRIBUTE_PURE ++me_for_dev (dev_t dev) + { + struct devlist *dl = device_list; + + while (dl) + { + if (dl->dev_num == dev) +- return dl->me->me_devname; ++ return dl->me; + dl = dl->next; + } + +@@ -928,12 +928,15 @@ get_dev (char const *disk, char const *m + else if (process_all && show_all_fs) + { + /* Ensure we don't output incorrect stats for over-mounted directories. +- Discard stats when the device name doesn't match. */ ++ Discard stats when the device name doesn't match. Though don't ++ discard when used and current mount entries are both remote due ++ to the possibility of aliased host names or exports. */ + struct stat sb; + if (stat (stat_file, &sb) == 0) + { +- char const * devname = devname_for_dev (sb.st_dev); +- if (devname && ! STREQ (devname, disk)) ++ struct mount_entry const * dev_me = me_for_dev (sb.st_dev); ++ if (dev_me && ! STREQ (dev_me->me_devname, disk) ++ && (! dev_me->me_remote || ! me_remote)) + { + fstype = "-"; + fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = diff --git a/coreutils-df-total-suppress-separate-remotes.patch b/coreutils-df-total-suppress-separate-remotes.patch new file mode 100644 index 0000000..758ceef --- /dev/null +++ b/coreutils-df-total-suppress-separate-remotes.patch @@ -0,0 +1,250 @@ +Upstream patch for df(1) on top of v8.23, to be removed with v8.24. +http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2e81e6224340 + +From 2e81e62243409c5c574b899f52b08c000e4d99fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Wed, 29 Oct 2014 02:49:17 +0000 +Subject: [PATCH] df: only suppress remote mounts of separate exports with + --total + +* src/df.c (filter_mount_list): Separate remote locations are +generally explicitly mounted, so list each even if they share +the same remote device and thus storage. However with --total +keep the suppression to give a more accurate value for the +total storage available. +(usage): Expand on the new implications of --total and move +it in the options list according to alphabetic order. +doc/coreutils.texi (df invocation): Mention that --total impacts +on deduplication of remote file systems and also move location +according to alphabetic order. +* tests/df/skip-duplicates.sh: Add remote test cases. +* NEWS: Mention the change in behavior. + +Reported in http://bugs.debian.org/737399 +Reported in http://bugzilla.redhat.com/920806 +Reported in http://bugzilla.opensuse.org/866010 +Reported in http://bugzilla.opensuse.org/901905 +--- + NEWS | 8 ++++++++ + doc/coreutils.texi | 28 +++++++++++++++------------- + src/df.c | 41 ++++++++++++++++++++++++++++------------- + tests/df/skip-duplicates.sh | 31 ++++++++++++++++++++++++++++--- + 4 files changed, 79 insertions(+), 29 deletions(-) + +Index: NEWS +=================================================================== +--- NEWS.orig ++++ NEWS +@@ -1,5 +1,13 @@ + GNU coreutils NEWS -*- outline -*- + ++** Changes in behavior ++ ++ df no longer suppresses separate exports of the same remote device, as ++ these are generally explicitly mounted. The --total option does still ++ suppress duplicate remote file systems. ++ [suppression was introduced in coreutils-8.21] ++ ++ + * Noteworthy changes in release 8.23 (2014-07-18) [stable] + + ** Bug fixes +Index: doc/coreutils.texi +=================================================================== +--- doc/coreutils.texi.orig ++++ doc/coreutils.texi +@@ -11202,19 +11202,6 @@ due to permissions of the mount point et + Scale sizes by @var{size} before printing them (@pxref{Block size}). + For example, @option{-BG} prints sizes in units of 1,073,741,824 bytes. + +-@item --total +-@opindex --total +-@cindex grand total of disk size, usage and available space +-Print a grand total of all arguments after all arguments have +-been processed. This can be used to find out the total disk size, usage +-and available space of all listed devices. +- +-For the grand total line, @command{df} prints @samp{"total"} into the +-@var{source} column, and @samp{"-"} into the @var{target} column. +-If there is no @var{source} column (see @option{--output}), then +-@command{df} prints @samp{"total"} into the @var{target} column, +-if present. +- + @optHumanReadable + + @item -H +@@ -11355,6 +11342,21 @@ some systems (notably SunOS), doing this + but in general this option makes @command{df} much slower, especially when + there are many or very busy file systems. + ++@item --total ++@opindex --total ++@cindex grand total of disk size, usage and available space ++Print a grand total of all arguments after all arguments have ++been processed. This can be used to find out the total disk size, usage ++and available space of all listed devices. If no arguments are specified ++df will try harder to elide file systems insignificant to the total ++available space, by suppressing duplicate remote file systems. ++ ++For the grand total line, @command{df} prints @samp{"total"} into the ++@var{source} column, and @samp{"-"} into the @var{target} column. ++If there is no @var{source} column (see @option{--output}), then ++@command{df} prints @samp{"total"} into the @var{target} column, ++if present. ++ + @item -t @var{fstype} + @itemx --type=@var{fstype} + @opindex -t +Index: src/df.c +=================================================================== +--- src/df.c.orig ++++ src/df.c +@@ -640,18 +640,28 @@ filter_mount_list (bool devices_only) + + if (devlist) + { +- /* let "real" devices with '/' in the name win. */ +- if ((strchr (me->me_devname, '/') +- && ! strchr (devlist->me->me_devname, '/')) +- /* let a shorter mountdir win. */ +- || (strlen (devlist->me->me_mountdir) +- > strlen (me->me_mountdir)) +- /* let an entry overmounted on a different device win... */ +- || (! STREQ (devlist->me->me_devname, me->me_devname) +- /* ... but only when matching an existing mount point, to +- avoid problematic replacement when given inaccurate mount +- lists, seen with some chroot environments for example. */ +- && STREQ (me->me_mountdir, devlist->me->me_mountdir))) ++ if (! print_grand_total && me->me_remote && devlist->me->me_remote ++ && ! STREQ (devlist->me->me_devname, me->me_devname)) ++ { ++ /* Don't discard remote entries with different locations, ++ as these are more likely to be explicitly mounted. ++ However avoid this when producing a total to give ++ a more accurate value in that case. */ ++ } ++ else if ((strchr (me->me_devname, '/') ++ /* let "real" devices with '/' in the name win. */ ++ && ! strchr (devlist->me->me_devname, '/')) ++ /* let a shorter mountdir win. */ ++ || (strlen (devlist->me->me_mountdir) ++ > strlen (me->me_mountdir)) ++ /* let an entry overmounted on a new device win... */ ++ || (! STREQ (devlist->me->me_devname, me->me_devname) ++ /* ... but only when matching an existing mnt point, ++ to avoid problematic replacement when given ++ inaccurate mount lists, seen with some chroot ++ environments for example. */ ++ && STREQ (me->me_mountdir, ++ devlist->me->me_mountdir))) + { + /* Discard mount entry for existing device. */ + discard_me = devlist->me; +@@ -1403,7 +1413,6 @@ or all file systems by default.\n\ + -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ + '-BM' prints sizes in units of 1,048,576 bytes;\n\ + see SIZE format below\n\ +- --total produce a grand total\n\ + -h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\ + -H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\ + "), stdout); +@@ -1419,6 +1428,12 @@ or all file systems by default.\n\ + or print all fields if FIELD_LIST is omitted.\n\ + -P, --portability use the POSIX output format\n\ + --sync invoke sync before getting usage info\n\ ++"), stdout); ++ fputs (_("\ ++ --total elide all entries insignificant to available space,\n\ ++ and produce a grand total\n\ ++"), stdout); ++ fputs (_("\ + -t, --type=TYPE limit listing to file systems of type TYPE\n\ + -T, --print-type print file system type\n\ + -x, --exclude-type=TYPE limit listing to file systems not of type TYPE\n\ +Index: tests/df/skip-duplicates.sh +=================================================================== +--- tests/df/skip-duplicates.sh.orig ++++ tests/df/skip-duplicates.sh +@@ -26,7 +26,12 @@ require_gcc_shared_ + df --local || skip_ "df fails" + + export CU_NONROOT_FS=$(df --local --output=target 2>&1 | grep /. | head -n1) +-test -z "$CU_NONROOT_FS" && unique_entries=1 || unique_entries=2 ++export CU_REMOTE_FS=$(df --local --output=target 2>&1 | grep /. | ++ tail -n+2 | head -n1) ++ ++unique_entries=1 ++test -z "$CU_NONROOT_FS" || unique_entries=$(expr $unique_entries + 1) ++test -z "$CU_REMOTE_FS" || unique_entries=$(expr $unique_entries + 2) + + grep '^#define HAVE_MNTENT_H 1' $CONFIG_HEADER > /dev/null \ + || skip_ "no mntent.h available to confirm the interface" +@@ -46,6 +51,7 @@ cat > k.c <<'EOF' || framework_failure_ + struct mntent *getmntent (FILE *fp) + { + static char *nonroot_fs; ++ static char *remote_fs; + static int done; + + /* Prove that LD_PRELOAD works. */ +@@ -63,6 +69,9 @@ struct mntent *getmntent (FILE *fp) + {.mnt_fsname="virtfs", .mnt_dir="/NONROOT", .mnt_type="fstype1"}, + {.mnt_fsname="virtfs2", .mnt_dir="/NONROOT", .mnt_type="fstype2"}, + {.mnt_fsname="netns", .mnt_dir="net:[1234567]"}, ++ {.mnt_fsname="rem:ote1",.mnt_dir="/REMOTE"}, ++ {.mnt_fsname="rem:ote1",.mnt_dir="/REMOTE"}, ++ {.mnt_fsname="rem:ote2",.mnt_dir="/REMOTE"}, + }; + + if (done == 1) +@@ -70,17 +79,26 @@ struct mntent *getmntent (FILE *fp) + nonroot_fs = getenv ("CU_NONROOT_FS"); + if (!nonroot_fs || !*nonroot_fs) + nonroot_fs = "/"; /* merge into / entries. */ ++ ++ remote_fs = getenv ("CU_REMOTE_FS"); + } + + if (done == 1 && !getenv ("CU_TEST_DUPE_INVALID")) + done++; /* skip the first entry. */ + +- while (done++ <= 7) ++ while (done++ <= 10) + { + if (!mntents[done-2].mnt_type) + mntents[done-2].mnt_type = "-"; + if (STREQ (mntents[done-2].mnt_dir, "/NONROOT")) + mntents[done-2].mnt_dir = nonroot_fs; ++ if (STREQ (mntents[done-2].mnt_dir, "/REMOTE")) ++ { ++ if (!remote_fs || !*remote_fs) ++ continue; ++ else ++ mntents[done-2].mnt_dir = remote_fs; ++ } + return &mntents[done-2]; + } + +@@ -102,6 +120,12 @@ test -f x || skip_ "internal test failur + LD_PRELOAD=./k.so df -T >out || fail=1 + test $(wc -l out || fail=1 ++test "$CU_REMOTE_FS" && elide_remote=1 || elide_remote=0 ++test $(wc -l out || fail=1 + test $(wc -l out || fail=1 +-test $(wc -l