- Incorporate 9 bugfixes, one documentation update and two maintenance
patches that won't harm (bnc#888215), See NEWS for specifics: coreutils-improve_df_--human_and_--si,_help_and_man_page.patch coreutils-avoid_sizeof_charPP__static_analysis_warning.patch coreutils-also_deduplicate_virtual_file_systems.patch coreutils-fix_handling_of_symlinks_in_mount_list.patch coreutils-ignore_non_file_system_entries_in_proc_mounts.patch coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch coreutils-use_the_last_device_name_provided_by_the_system.patch coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch coreutils-use_all_of_the_last_device_details_provided.patch coreutils-output_placeholder_values_for_inaccessible_mount_points.patch coreutils-look_for_accessible_mount_points_for_specified_devices.patch coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch coreutils-avoid_an_inconsequential_mem_leak.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=233
This commit is contained in:
parent
ad3c637e06
commit
9a063f8a1f
186
coreutils-also_deduplicate_virtual_file_systems.patch
Normal file
186
coreutils-also_deduplicate_virtual_file_systems.patch
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
commit 2dc5d044a88fd64e11e35886e78b54a4a9fc2b23
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Sat Jan 25 01:14:29 2014 +0000
|
||||||
|
|
||||||
|
df: also deduplicate virtual file systems
|
||||||
|
|
||||||
|
* src/df.c (filter_mountlist): Remove the constraint that
|
||||||
|
a '/' needs to be in the device name for a mount entry to
|
||||||
|
be considered for deduplication. Virtual file systems also
|
||||||
|
have storage associated with them (like tmpfs for example),
|
||||||
|
and thus need to be deduplicated since they will be shown
|
||||||
|
in the default df output and subject to --total processing also.
|
||||||
|
* test/df/skip-duplicates.sh: Add a test to ensure we deduplicate
|
||||||
|
all entries, even for virtual file systems. Also avoid possible
|
||||||
|
length operations on many remote file systems in the initial
|
||||||
|
check of df operation. Also avoid the assumption that "/root"
|
||||||
|
is on the same file system as "/".
|
||||||
|
* NEWS: Mention the change in behavior.
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 6 ++++-
|
||||||
|
src/df.c | 31 +++++++++++++----------------
|
||||||
|
tests/df/skip-duplicates.sh | 47 +++++++++++++++++++++++++++++++-------------
|
||||||
|
3 files changed, 53 insertions(+), 31 deletions(-)
|
||||||
|
|
||||||
|
Index: coreutils-8.22/NEWS
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/NEWS 2014-07-25 23:59:19.944878976 +0200
|
||||||
|
+++ coreutils-8.22/NEWS 2014-07-26 00:00:28.937016455 +0200
|
||||||
|
@@ -1,6 +1,10 @@
|
||||||
|
GNU coreutils NEWS -*- outline -*-
|
||||||
|
|
||||||
|
-* Noteworthy changes in release 8.22 (2013-12-13) [stable]
|
||||||
|
+ Changes done after the release of 8.22
|
||||||
|
+
|
||||||
|
+ df now correctly elides duplicates for virtual file systems like tmpfs.
|
||||||
|
+
|
||||||
|
+ Noteworthy changes in release 8.22 (2013-12-13) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Index: coreutils-8.22/src/df.c
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/src/df.c 2014-07-25 23:59:19.938879051 +0200
|
||||||
|
+++ coreutils-8.22/src/df.c 2014-07-25 23:59:19.944878976 +0200
|
||||||
|
@@ -630,26 +630,23 @@ filter_mount_list (void)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- /* If the device name is a real path name ... */
|
||||||
|
- if (strchr (me->me_devname, '/'))
|
||||||
|
+ /* If we've already seen this device... */
|
||||||
|
+ for (devlist = devlist_head; devlist; devlist = devlist->next)
|
||||||
|
+ if (devlist->dev_num == buf.st_dev)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if (devlist)
|
||||||
|
{
|
||||||
|
- /* ... try to find its device number in the devlist. */
|
||||||
|
- for (devlist = devlist_head; devlist; devlist = devlist->next)
|
||||||
|
- if (devlist->dev_num == buf.st_dev)
|
||||||
|
- break;
|
||||||
|
+ discard_me = me;
|
||||||
|
|
||||||
|
- if (devlist)
|
||||||
|
+ /* ...let the shorter mountdir win. */
|
||||||
|
+ if ((strchr (me->me_devname, '/')
|
||||||
|
+ && ! strchr (devlist->me->me_devname, '/'))
|
||||||
|
+ || (strlen (devlist->me->me_mountdir)
|
||||||
|
+ > strlen (me->me_mountdir)))
|
||||||
|
{
|
||||||
|
- discard_me = me;
|
||||||
|
-
|
||||||
|
- /* Let the shorter mountdir win. */
|
||||||
|
- if (! strchr (devlist->me->me_devname, '/')
|
||||||
|
- || (strlen (devlist->me->me_mountdir)
|
||||||
|
- > strlen (me->me_mountdir)))
|
||||||
|
- {
|
||||||
|
- discard_me = devlist->me;
|
||||||
|
- devlist->me = me;
|
||||||
|
- }
|
||||||
|
+ discard_me = devlist->me;
|
||||||
|
+ devlist->me = me;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Index: coreutils-8.22/tests/df/skip-duplicates.sh
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/tests/df/skip-duplicates.sh 2013-12-04 15:48:30.000000000 +0100
|
||||||
|
+++ coreutils-8.22/tests/df/skip-duplicates.sh 2014-07-25 23:59:19.944878976 +0200
|
||||||
|
@@ -21,19 +21,28 @@
|
||||||
|
print_ver_ df
|
||||||
|
require_gcc_shared_
|
||||||
|
|
||||||
|
-df || skip_ "df fails"
|
||||||
|
+# We use --local here so as to not activate
|
||||||
|
+# potentially very many remote mounts.
|
||||||
|
+df --local || skip_ "df fails"
|
||||||
|
|
||||||
|
-# Simulate an mtab file with two entries of the same device number.
|
||||||
|
-# Also add entries with unstatable mount dirs to ensure that's handled.
|
||||||
|
+export CU_NONROOT_FS=$(df --local --output=target 2>&1 | grep /. | head -n1)
|
||||||
|
+test -z "$CU_NONROOT_FS" && unique_entries=1 || unique_entries=2
|
||||||
|
+
|
||||||
|
+# Simulate an mtab file to test various cases.
|
||||||
|
cat > k.c <<'EOF' || framework_failure_
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
+#include <string.h>
|
||||||
|
#include <mntent.h>
|
||||||
|
|
||||||
|
+#define STREQ(a, b) (strcmp (a, b) == 0)
|
||||||
|
+
|
||||||
|
struct mntent *getmntent (FILE *fp)
|
||||||
|
{
|
||||||
|
+ static char *nonroot_fs;
|
||||||
|
+ static int done;
|
||||||
|
+
|
||||||
|
/* Prove that LD_PRELOAD works. */
|
||||||
|
- static int done = 0;
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
fclose (fopen ("x", "w"));
|
||||||
|
@@ -43,18 +52,30 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
static struct mntent mntents[] = {
|
||||||
|
{.mnt_fsname="/short", .mnt_dir="/invalid/mount/dir"},
|
||||||
|
{.mnt_fsname="fsname", .mnt_dir="/",},
|
||||||
|
- {.mnt_fsname="/fsname", .mnt_dir="/root"},
|
||||||
|
+ {.mnt_fsname="/fsname", .mnt_dir="/."},
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/"},
|
||||||
|
+ {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
+ {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
};
|
||||||
|
|
||||||
|
- if (!getenv ("CU_TEST_DUPE_INVALID") && done == 1)
|
||||||
|
+ if (done == 1)
|
||||||
|
+ {
|
||||||
|
+ nonroot_fs = getenv ("CU_NONROOT_FS");
|
||||||
|
+ if (!nonroot_fs || !*nonroot_fs)
|
||||||
|
+ nonroot_fs = "/"; /* merge into / entries. */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (done == 1 && !getenv ("CU_TEST_DUPE_INVALID"))
|
||||||
|
done++; /* skip the first entry. */
|
||||||
|
|
||||||
|
- while (done++ <= 4)
|
||||||
|
+ while (done++ <= 6)
|
||||||
|
{
|
||||||
|
mntents[done-2].mnt_type = "-";
|
||||||
|
+ if (STREQ (mntents[done-2].mnt_dir, "/NONROOT"))
|
||||||
|
+ mntents[done-2].mnt_dir = nonroot_fs;
|
||||||
|
return &mntents[done-2];
|
||||||
|
}
|
||||||
|
+
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
@@ -69,22 +90,22 @@ test -f x || skip_ "internal test failur
|
||||||
|
|
||||||
|
# The fake mtab file should only contain entries
|
||||||
|
# having the same device number; thus the output should
|
||||||
|
-# consist of a header and one entry.
|
||||||
|
+# consist of a header and unique entries.
|
||||||
|
LD_PRELOAD=./k.so df >out || fail=1
|
||||||
|
-test $(wc -l <out) -eq 2 || { fail=1; cat out; }
|
||||||
|
+test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure we fail when unable to stat invalid entries
|
||||||
|
LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1 df >out && fail=1
|
||||||
|
-test $(wc -l <out) -eq 2 || { fail=1; cat out; }
|
||||||
|
+test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# df should also prefer "/fsname" over "fsname"
|
||||||
|
test $(grep -c '/fsname' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
-# ... and "/fsname" with '/' as Mounted on over '/root'
|
||||||
|
-test $(grep -c '/root' <out) -eq 0 || { fail=1; cat out; }
|
||||||
|
+# ... and "/fsname" with '/' as Mounted on over '/.'
|
||||||
|
+test $(grep -cF '/.' <out) -eq 0 || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure that filtering duplicates does not affect -a processing.
|
||||||
|
LD_PRELOAD=./k.so df -a >out || fail=1
|
||||||
|
-test $(wc -l <out) -eq 4 || { fail=1; cat out; }
|
||||||
|
+test $(wc -l <out) -eq 6 || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure that filtering duplicates does not affect
|
||||||
|
# argument processing (now without the fake getmntent()).
|
44
coreutils-avoid_an_inconsequential_mem_leak.patch
Normal file
44
coreutils-avoid_an_inconsequential_mem_leak.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
commit dbd7c9452a121f948b4eabbe22e07ad13900bc9b
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Sun Jul 13 19:16:42 2014 +0100
|
||||||
|
|
||||||
|
maint: avoid an inconsequential mem leak
|
||||||
|
|
||||||
|
* src/df.c (get_disk): Avoid an inconsequential mem leak
|
||||||
|
spotted by coverity. Also s/duplicities/duplicates/.
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 063cabf..3ef5d33 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -44,7 +44,7 @@
|
||||||
|
proper_name ("Paul Eggert")
|
||||||
|
|
||||||
|
/* Filled with device numbers of examined file systems to avoid
|
||||||
|
- duplicities in output. */
|
||||||
|
+ duplicates in output. */
|
||||||
|
static struct devlist
|
||||||
|
{
|
||||||
|
dev_t dev_num;
|
||||||
|
@@ -604,7 +604,7 @@ excluded_fstype (const char *fstype)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter mount list by skipping duplicate entries.
|
||||||
|
- In the case of duplicities - based on the device number - the mount entry
|
||||||
|
+ In the case of duplicates - based on the device number - the mount entry
|
||||||
|
with a '/' in its me_devname (i.e. not pseudo name like tmpfs) wins.
|
||||||
|
If both have a real devname (e.g. bind mounts), then that with the shorter
|
||||||
|
me_mountdir wins. With DEVICES_ONLY == true (set with df -a), only update
|
||||||
|
@@ -1185,7 +1185,11 @@ get_disk (char const *disk)
|
||||||
|
{
|
||||||
|
best_match = me;
|
||||||
|
if (len == 1) /* Traditional root. */
|
||||||
|
- break;
|
||||||
|
+ {
|
||||||
|
+ free (last_device);
|
||||||
|
+ free (canon_dev);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
else
|
||||||
|
best_match_len = len;
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
commit ffd1a1d8dee921e20db515e7d4b3c3e47006c8b4
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Mon May 12 15:46:43 2014 +0100
|
||||||
|
|
||||||
|
maint: avoid clang -Wtautological-constant-out-of-range-compare warning
|
||||||
|
|
||||||
|
* src/df.c (decode_output_arg): Use only enum constants to avoid
|
||||||
|
clang "warning: comparison of constant -1 with expression of
|
||||||
|
type 'display_field_t' is always false"
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index a7fc57f..01ecca6 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -144,7 +144,8 @@ typedef enum
|
||||||
|
IAVAIL_FIELD, /* inodes available */
|
||||||
|
IPCENT_FIELD, /* inodes used in percent */
|
||||||
|
TARGET_FIELD, /* mount point */
|
||||||
|
- FILE_FIELD /* specified file name */
|
||||||
|
+ FILE_FIELD, /* specified file name */
|
||||||
|
+ INVALID_FIELD /* validation marker */
|
||||||
|
} display_field_t;
|
||||||
|
|
||||||
|
/* Flag if a field contains a block, an inode or another value. */
|
||||||
|
@@ -372,7 +373,7 @@ decode_output_arg (char const *arg)
|
||||||
|
*comma++ = 0;
|
||||||
|
|
||||||
|
/* process S. */
|
||||||
|
- display_field_t field = -1;
|
||||||
|
+ display_field_t field = INVALID_FIELD;
|
||||||
|
for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++)
|
||||||
|
{
|
||||||
|
if (STREQ (field_data[i].arg, s))
|
||||||
|
@@ -381,7 +382,7 @@ decode_output_arg (char const *arg)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (field == -1)
|
||||||
|
+ if (field == INVALID_FIELD)
|
||||||
|
{
|
||||||
|
error (0, 0, _("option --output: field %s unknown"), quote (s));
|
||||||
|
usage (EXIT_FAILURE);
|
@ -0,0 +1,35 @@
|
|||||||
|
commit 1239ac573df0a699d6999aed23caaf4a0eb099df
|
||||||
|
Author: Ben Walton <bdwalton@gmail.com>
|
||||||
|
Date: Mon Jun 2 20:32:16 2014 +0100
|
||||||
|
|
||||||
|
maint: avoid compiler warnings with some assert() implementations
|
||||||
|
|
||||||
|
* src/df.c (get_dev): asssert() on Solaris 10 is not marked as
|
||||||
|
__noreturn__ and thus the compiler may think V is uninitialized
|
||||||
|
later on in the function.
|
||||||
|
* THANKS.in: Remove the now committer.
|
||||||
|
|
||||||
|
diff --git a/THANKS.in b/THANKS.in
|
||||||
|
index a92540a..6fd79d3 100644
|
||||||
|
--- a/THANKS.in
|
||||||
|
+++ b/THANKS.in
|
||||||
|
@@ -77,7 +77,6 @@ Barry Kelly http://barrkel.blogspot.com/
|
||||||
|
Bauke Jan Douma bjdouma@xs4all.nl
|
||||||
|
Ben Elliston bje@air.net.au
|
||||||
|
Ben Harris bjh21@netbsd.org
|
||||||
|
-Ben Walton bwalton@artsci.utoronto.ca
|
||||||
|
Bengt Martensson bengt@mathematik.uni-Bremen.de
|
||||||
|
Benjamin Cutler cutlerbc@simla.colostate.edu
|
||||||
|
Bernard Giroud bernard.giroud@creditlyonnais.ch
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 82b0c5f..747d138 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -953,6 +953,7 @@ get_dev (char const *disk, char const *mount_point, char const* file,
|
||||||
|
v = NULL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
+ v = NULL; /* Avoid warnings where assert() is not __noreturn__. */
|
||||||
|
assert (!"bad field_type");
|
||||||
|
}
|
||||||
|
|
22
coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
Normal file
22
coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
commit 02807c611efa0d2052c4d2f852a84b22c49d9e52
|
||||||
|
Author: Bernhard Voelker <mail@bernhard-voelker.de>
|
||||||
|
Date: Wed Apr 16 10:43:09 2014 +0200
|
||||||
|
|
||||||
|
maint: df: avoid sizeof(char**) static analysis warning
|
||||||
|
|
||||||
|
* src/df.c (alloc_table_row): Use the size of char** to enlarge
|
||||||
|
the table. Spotted by Coverity.
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 3036c74..e763943 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -290,7 +290,7 @@ static void
|
||||||
|
alloc_table_row (void)
|
||||||
|
{
|
||||||
|
nrows++;
|
||||||
|
- table = xnrealloc (table, nrows, sizeof (char *));
|
||||||
|
+ table = xnrealloc (table, nrows, sizeof (char **));
|
||||||
|
table[nrows - 1] = xnmalloc (ncolumns, sizeof (char *));
|
||||||
|
}
|
||||||
|
|
75
coreutils-fix_handling_of_symlinks_in_mount_list.patch
Normal file
75
coreutils-fix_handling_of_symlinks_in_mount_list.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
commit fb902297f536df060ff10ef06bb8fe6cfe0c845e
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Mon May 12 13:29:01 2014 +0100
|
||||||
|
|
||||||
|
df: fix handling of symlinks in mount list
|
||||||
|
|
||||||
|
The symlink handling in commit v8.21-172-g33660b4 was incomplete
|
||||||
|
in the case where there were symlinks in the mount list itself.
|
||||||
|
For example, in the case where /dev/mapper/fedora-home was in the
|
||||||
|
mount list and that in turn was a symlink to /dev/dm-2, we have:
|
||||||
|
|
||||||
|
before> df --out=source /dev/mapper/fedora-home
|
||||||
|
devtmpfs
|
||||||
|
|
||||||
|
after > df --out=source /dev/mapper/fedora-home
|
||||||
|
/dev/mapper/fedora-home
|
||||||
|
|
||||||
|
* src/df.c (get_disk): Compare canonicalized device names from
|
||||||
|
the mount list. Note we still display the non canonicalized name,
|
||||||
|
even if longer, as we assume that is the most representative.
|
||||||
|
* tests/df/df-symlink.sh: This could theoretically fail on some systems
|
||||||
|
depending on the content of the mount list, but adjust to fail on any
|
||||||
|
system where symlinks are present in the mount list for the current dir.
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 2b5a54e..24897a3 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -1056,13 +1056,19 @@ get_disk (char const *disk)
|
||||||
|
char const *file = disk;
|
||||||
|
|
||||||
|
char *resolved = canonicalize_file_name (disk);
|
||||||
|
- if (resolved && resolved[0] == '/')
|
||||||
|
+ if (resolved && IS_ABSOLUTE_FILE_NAME (resolved))
|
||||||
|
disk = resolved;
|
||||||
|
|
||||||
|
size_t best_match_len = SIZE_MAX;
|
||||||
|
for (me = mount_list; me; me = me->me_next)
|
||||||
|
{
|
||||||
|
- if (STREQ (disk, me->me_devname))
|
||||||
|
+ /* TODO: Should cache canon_dev in the mount_entry struct. */
|
||||||
|
+ char *devname = me->me_devname;
|
||||||
|
+ char *canon_dev = canonicalize_file_name (me->me_devname);
|
||||||
|
+ if (canon_dev && IS_ABSOLUTE_FILE_NAME (canon_dev))
|
||||||
|
+ devname = canon_dev;
|
||||||
|
+
|
||||||
|
+ if (STREQ (disk, devname))
|
||||||
|
{
|
||||||
|
size_t len = strlen (me->me_mountdir);
|
||||||
|
if (len < best_match_len)
|
||||||
|
@@ -1074,6 +1080,8 @@ get_disk (char const *disk)
|
||||||
|
best_match_len = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ free (canon_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (resolved);
|
||||||
|
diff --git a/tests/df/df-symlink.sh b/tests/df/df-symlink.sh
|
||||||
|
index aaed810..6d96bd2 100755
|
||||||
|
--- a/tests/df/df-symlink.sh
|
||||||
|
+++ b/tests/df/df-symlink.sh
|
||||||
|
@@ -28,4 +28,11 @@ df --out=source,target "$disk" > exp || skip_ "cannot get info for $disk"
|
||||||
|
df --out=source,target symlink > out || fail=1
|
||||||
|
compare exp out || fail=1
|
||||||
|
|
||||||
|
+# Ensure we output the same values for device nodes and '.'
|
||||||
|
+# This was not the case in coreutil-8.22 on systems
|
||||||
|
+# where the device in the mount list was a symlink itself.
|
||||||
|
+# I.E. '.' => /dev/mapper/fedora-home -> /dev/dm-2
|
||||||
|
+df --out=source,target '.' > out || fail=1
|
||||||
|
+compare exp out || fail=1
|
||||||
|
+
|
||||||
|
Exit $fail
|
@ -0,0 +1,51 @@
|
|||||||
|
commit cbfb34c7d32e888b39e03a51a374ed664e9fa31b
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Mon May 12 14:49:13 2014 +0100
|
||||||
|
|
||||||
|
df: ignore non file system entries in /proc/mounts
|
||||||
|
|
||||||
|
Linux with network namespaces contains entries in /proc/mounts like:
|
||||||
|
proc net:[4026532464] proc rw,nosuid,nodev,noexec,relatime 0 0
|
||||||
|
resulting in a failure to stat 'net:[...]', inducing a warning
|
||||||
|
and an exit with failure status.
|
||||||
|
|
||||||
|
* src/df.c (get_dev): Ignore all relative mount points.
|
||||||
|
* tests/df/skip-duplicates.sh: Add an entry to test relative dirs.
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 24897a3..a7fc57f 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -853,6 +853,11 @@ get_dev (char const *disk, char const *mount_point, char const* file,
|
||||||
|
if (!selected_fstype (fstype) || excluded_fstype (fstype))
|
||||||
|
return;
|
||||||
|
|
||||||
|
+ /* Ignore relative MOUNT_POINTs, which are present for example
|
||||||
|
+ in /proc/mounts on Linux with network namespaces. */
|
||||||
|
+ if (!force_fsu && mount_point && ! IS_ABSOLUTE_FILE_NAME (mount_point))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
/* If MOUNT_POINT is NULL, then the file system is not mounted, and this
|
||||||
|
program reports on the file system that the special file is on.
|
||||||
|
It would be better to report on the unmounted file system,
|
||||||
|
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
|
||||||
|
index d872f27..44f7d4c 100755
|
||||||
|
--- a/tests/df/skip-duplicates.sh
|
||||||
|
+++ b/tests/df/skip-duplicates.sh
|
||||||
|
@@ -56,6 +56,7 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/"},
|
||||||
|
{.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
{.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
+ {.mnt_fsname="netns", .mnt_dir="net:[1234567]"},
|
||||||
|
};
|
||||||
|
|
||||||
|
if (done == 1)
|
||||||
|
@@ -68,7 +69,7 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
if (done == 1 && !getenv ("CU_TEST_DUPE_INVALID"))
|
||||||
|
done++; /* skip the first entry. */
|
||||||
|
|
||||||
|
- while (done++ <= 6)
|
||||||
|
+ while (done++ <= 7)
|
||||||
|
{
|
||||||
|
mntents[done-2].mnt_type = "-";
|
||||||
|
if (STREQ (mntents[done-2].mnt_dir, "/NONROOT"))
|
@ -0,0 +1,53 @@
|
|||||||
|
commit 849c1c5b16c32756e14be719855601017770e621
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Mon Mar 3 02:49:25 2014 +0000
|
||||||
|
|
||||||
|
doc: improve df --human and --si, help and man page
|
||||||
|
|
||||||
|
* src/df.c (usage): Adjust the --human and --si descriptions
|
||||||
|
to not depend on each other. Also include an example that is
|
||||||
|
illustrative of the rounding, suffix, width, and localized fractions.
|
||||||
|
* src/system.h (emit_size_note). Adjust so that it's obvious the
|
||||||
|
description is pertaining to the input SIZE argument, and not
|
||||||
|
to any sizes that might be output by df for example.
|
||||||
|
Fixes http://bugs.gnu.org/16922
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index e4fafb9..3036c74 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -1260,15 +1260,16 @@ or all file systems by default.\n\
|
||||||
|
|
||||||
|
emit_mandatory_arg_note ();
|
||||||
|
|
||||||
|
+ /* TRANSLATORS: The thousands and decimal separators are best
|
||||||
|
+ adjusted to an appropriate default for your locale. */
|
||||||
|
fputs (_("\
|
||||||
|
-a, --all include dummy 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\
|
||||||
|
--total produce a grand total\n\
|
||||||
|
- -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)\
|
||||||
|
-\n\
|
||||||
|
- -H, --si likewise, but use powers of 1000 not 1024\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);
|
||||||
|
fputs (_("\
|
||||||
|
-i, --inodes list inode information instead of block usage\n\
|
||||||
|
diff --git a/src/system.h b/src/system.h
|
||||||
|
index 39750e8..a9588e7 100644
|
||||||
|
--- a/src/system.h
|
||||||
|
+++ b/src/system.h
|
||||||
|
@@ -549,8 +549,8 @@ static inline void
|
||||||
|
emit_size_note (void)
|
||||||
|
{
|
||||||
|
fputs (_("\n\
|
||||||
|
-SIZE is an integer and optional unit (example: 10M is 10*1024*1024). Units\n\
|
||||||
|
-are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).\n\
|
||||||
|
+The SIZE argument is an integer and optional unit (example: 10K is 10*1024).\n\
|
||||||
|
+Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).\n\
|
||||||
|
"), stdout);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
commit 828801a174de8fa6e492f311210c37394f13b30f
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Wed Jun 18 13:10:17 2014 +0100
|
||||||
|
|
||||||
|
df: look for accessible mount points for specified devices
|
||||||
|
|
||||||
|
* src/df.c (get_disk): Include whether we can access the mount dir,
|
||||||
|
in the mount entry selection criteria. This handles the case where
|
||||||
|
a device is (bind) mounted multiple times with the shortest mount path
|
||||||
|
not being accessible, while some of the other mount points are.
|
||||||
|
Discussed at: http://bugs.gnu.org/16539#63
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index d6d4b0e..dc6544b 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -1121,6 +1121,7 @@ get_disk (char const *disk)
|
||||||
|
{
|
||||||
|
struct mount_entry const *me;
|
||||||
|
struct mount_entry const *best_match = NULL;
|
||||||
|
+ bool best_match_accessible = false;
|
||||||
|
char const *file = disk;
|
||||||
|
|
||||||
|
char *resolved = canonicalize_file_name (disk);
|
||||||
|
@@ -1139,13 +1140,24 @@ get_disk (char const *disk)
|
||||||
|
if (STREQ (disk, devname))
|
||||||
|
{
|
||||||
|
size_t len = strlen (me->me_mountdir);
|
||||||
|
- if (len < best_match_len)
|
||||||
|
+
|
||||||
|
+ if (! best_match_accessible || len < best_match_len)
|
||||||
|
{
|
||||||
|
- best_match = me;
|
||||||
|
- if (len == 1) /* Traditional root. */
|
||||||
|
- break;
|
||||||
|
- else
|
||||||
|
- best_match_len = len;
|
||||||
|
+ struct stat disk_stats;
|
||||||
|
+ bool this_match_accessible = false;
|
||||||
|
+
|
||||||
|
+ if (stat (me->me_mountdir, &disk_stats) == 0)
|
||||||
|
+ best_match_accessible = this_match_accessible = true;
|
||||||
|
+
|
||||||
|
+ if (this_match_accessible
|
||||||
|
+ || (! best_match_accessible && len < best_match_len))
|
||||||
|
+ {
|
||||||
|
+ best_match = me;
|
||||||
|
+ if (len == 1) /* Traditional root. */
|
||||||
|
+ break;
|
||||||
|
+ else
|
||||||
|
+ best_match_len = len;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,258 @@
|
|||||||
|
commit 9d736f8dbfef2b33d431dccf852dace9cfc84d59
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Wed Jun 4 00:09:11 2014 +0100
|
||||||
|
|
||||||
|
df: output placeholder values for inaccessible mount points
|
||||||
|
|
||||||
|
A system provided mount entry may be unavailable due to TOCTOU race,
|
||||||
|
or if another device has been over-mounted at that position, or due to
|
||||||
|
access permissions. In all these cases output "-" placeholder values
|
||||||
|
rather than either producing an error, or in the over-mount case
|
||||||
|
outputting values for the wrong device.
|
||||||
|
|
||||||
|
* src/df.c (device_list): A new global list now updated by
|
||||||
|
filter_mount_list().
|
||||||
|
(filter_mount_list): Adjust to take a parameter as to whether
|
||||||
|
update the global mount list, or only the mount <-> device ID mapping.
|
||||||
|
(get_dev): Use the device ID mapping to ensure we're not outputting
|
||||||
|
stats for the wrong device. Also output placeholder values when we
|
||||||
|
can't access a system specified mount point.
|
||||||
|
(get_all_entries): Set the DEVICE_ONLY param for filter_mount_list().
|
||||||
|
(devname_for_dev): A new function to search the mount <-> dev mapping.
|
||||||
|
* test/df/skip-duplicates.sh: Adjust accordingly.
|
||||||
|
* NEWS: Mention the bug fixes.
|
||||||
|
|
||||||
|
Discussed at: http://bugs.gnu.org/16539
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 6 +-
|
||||||
|
src/df.c | 109 ++++++++++++++++++++++++++++++++------------
|
||||||
|
tests/df/skip-duplicates.sh | 6 +-
|
||||||
|
3 files changed, 89 insertions(+), 32 deletions(-)
|
||||||
|
|
||||||
|
Index: coreutils-8.22/NEWS
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/NEWS 2014-07-26 00:02:00.484871949 +0200
|
||||||
|
+++ coreutils-8.22/NEWS 2014-07-26 00:02:31.465484639 +0200
|
||||||
|
@@ -2,8 +2,10 @@ GNU coreutils NEWS
|
||||||
|
|
||||||
|
Changes done after the release of 8.22
|
||||||
|
|
||||||
|
- df now elides duplicates for virtual file systems like tmpfs, and will
|
||||||
|
- display the correct device name for directories mounted multiple times.
|
||||||
|
+ df now elides duplicates for virtual file systems like tmpfs.
|
||||||
|
+ Displays the correct device details for points mounted multiple times.
|
||||||
|
+ Displays placeholder values for inaccessible file systems,
|
||||||
|
+ rather than error messages or values for the wrong file system.
|
||||||
|
[These bugs were present in "the beginning".]
|
||||||
|
|
||||||
|
Noteworthy changes in release 8.22 (2013-12-13) [stable]
|
||||||
|
Index: coreutils-8.22/src/df.c
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/src/df.c 2014-07-26 00:02:00.468872150 +0200
|
||||||
|
+++ coreutils-8.22/src/df.c 2014-07-26 00:02:00.485871937 +0200
|
||||||
|
@@ -45,12 +45,12 @@
|
||||||
|
|
||||||
|
/* Filled with device numbers of examined file systems to avoid
|
||||||
|
duplicities in output. */
|
||||||
|
-struct devlist
|
||||||
|
+static struct devlist
|
||||||
|
{
|
||||||
|
dev_t dev_num;
|
||||||
|
struct mount_entry *me;
|
||||||
|
struct devlist *next;
|
||||||
|
-};
|
||||||
|
+} *device_list;
|
||||||
|
|
||||||
|
/* If true, show even file systems with zero size or
|
||||||
|
uninteresting types. */
|
||||||
|
@@ -607,23 +607,25 @@ excluded_fstype (const char *fstype)
|
||||||
|
In the case of duplicities - based on the device number - the mount entry
|
||||||
|
with a '/' in its me_devname (i.e. not pseudo name like tmpfs) wins.
|
||||||
|
If both have a real devname (e.g. bind mounts), then that with the shorter
|
||||||
|
- me_mountdir wins. */
|
||||||
|
+ me_mountdir wins. With DEVICES_ONLY == true (set with df -a), only update
|
||||||
|
+ the global device_list, rather than filtering the global mount_list. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
-filter_mount_list (void)
|
||||||
|
+filter_mount_list (bool devices_only)
|
||||||
|
{
|
||||||
|
struct mount_entry *me;
|
||||||
|
|
||||||
|
- /* Store of already-processed device numbers. */
|
||||||
|
- struct devlist *devlist_head = NULL;
|
||||||
|
-
|
||||||
|
- /* Sort all 'wanted' entries into the list devlist_head. */
|
||||||
|
+ /* Sort all 'wanted' entries into the list device_list. */
|
||||||
|
for (me = mount_list; me;)
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
struct devlist *devlist;
|
||||||
|
struct mount_entry *discard_me = NULL;
|
||||||
|
|
||||||
|
+ /* TODO: On Linux we might avoid this stat() and another in get_dev()
|
||||||
|
+ by using the device IDs available from /proc/self/mountinfo.
|
||||||
|
+ read_file_system_list() could populate me_dev from those
|
||||||
|
+ for efficiency and accuracy. */
|
||||||
|
if (-1 == stat (me->me_mountdir, &buf))
|
||||||
|
{
|
||||||
|
/* Stat failed - add ME to be able to complain about it later. */
|
||||||
|
@@ -632,7 +634,7 @@ filter_mount_list (void)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* If we've already seen this device... */
|
||||||
|
- for (devlist = devlist_head; devlist; devlist = devlist->next)
|
||||||
|
+ for (devlist = device_list; devlist; devlist = devlist->next)
|
||||||
|
if (devlist->dev_num == buf.st_dev)
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -661,8 +663,9 @@ filter_mount_list (void)
|
||||||
|
|
||||||
|
if (discard_me)
|
||||||
|
{
|
||||||
|
- me = me->me_next;
|
||||||
|
- free_mount_entry (discard_me);
|
||||||
|
+ me = me->me_next;
|
||||||
|
+ if (! devices_only)
|
||||||
|
+ free_mount_entry (discard_me);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -670,26 +673,46 @@ filter_mount_list (void)
|
||||||
|
devlist = xmalloc (sizeof *devlist);
|
||||||
|
devlist->me = me;
|
||||||
|
devlist->dev_num = buf.st_dev;
|
||||||
|
- devlist->next = devlist_head;
|
||||||
|
- devlist_head = devlist;
|
||||||
|
+ devlist->next = device_list;
|
||||||
|
+ device_list = devlist;
|
||||||
|
|
||||||
|
me = me->me_next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finally rebuild the mount_list from the devlist. */
|
||||||
|
- mount_list = NULL;
|
||||||
|
- while (devlist_head)
|
||||||
|
+ if (! devices_only) {
|
||||||
|
+ mount_list = NULL;
|
||||||
|
+ while (device_list)
|
||||||
|
+ {
|
||||||
|
+ /* Add the mount entry. */
|
||||||
|
+ me = device_list->me;
|
||||||
|
+ me->me_next = mount_list;
|
||||||
|
+ mount_list = me;
|
||||||
|
+ /* Free devlist entry and advance. */
|
||||||
|
+ struct devlist *devlist = device_list->next;
|
||||||
|
+ free (device_list);
|
||||||
|
+ device_list = devlist;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Search a mount entry list for device id DEV.
|
||||||
|
+ Return the corresponding device name if found or NULL if not. */
|
||||||
|
+
|
||||||
|
+static char const * _GL_ATTRIBUTE_PURE
|
||||||
|
+devname_for_dev (dev_t dev)
|
||||||
|
+{
|
||||||
|
+ struct devlist *dl = device_list;
|
||||||
|
+
|
||||||
|
+ while (dl)
|
||||||
|
{
|
||||||
|
- /* Add the mount entry. */
|
||||||
|
- me = devlist_head->me;
|
||||||
|
- me->me_next = mount_list;
|
||||||
|
- mount_list = me;
|
||||||
|
- /* Free devlist entry and advance. */
|
||||||
|
- struct devlist *devlist = devlist_head->next;
|
||||||
|
- free (devlist_head);
|
||||||
|
- devlist_head = devlist;
|
||||||
|
+ if (dl->dev_num == dev)
|
||||||
|
+ return dl->me->me_devname;
|
||||||
|
+ dl = dl->next;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return true if N is a known integer value. On many file systems,
|
||||||
|
@@ -878,9 +901,40 @@ get_dev (char const *disk, char const *m
|
||||||
|
fsu = *force_fsu;
|
||||||
|
else if (get_fs_usage (stat_file, disk, &fsu))
|
||||||
|
{
|
||||||
|
- error (0, errno, "%s", quote (stat_file));
|
||||||
|
- exit_status = EXIT_FAILURE;
|
||||||
|
- return;
|
||||||
|
+ /* If we can't access a system provided entry due
|
||||||
|
+ to it not being present (now), or due to permissions,
|
||||||
|
+ just output placeholder values rather than failing. */
|
||||||
|
+ if (process_all && (errno == EACCES || errno == ENOENT))
|
||||||
|
+ {
|
||||||
|
+ if (! show_all_fs)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ fstype = "-";
|
||||||
|
+ fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree =
|
||||||
|
+ fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ error (0, errno, "%s", quote (stat_file));
|
||||||
|
+ exit_status = EXIT_FAILURE;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ 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. */
|
||||||
|
+ struct stat sb;
|
||||||
|
+ if (stat (stat_file, &sb) == 0)
|
||||||
|
+ {
|
||||||
|
+ char const * devname = devname_for_dev (sb.st_dev);
|
||||||
|
+ if (devname && ! STREQ (devname, disk))
|
||||||
|
+ {
|
||||||
|
+ fstype = "-";
|
||||||
|
+ fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree =
|
||||||
|
+ fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fsu.fsu_blocks == 0 && !show_all_fs && !show_listed_fs)
|
||||||
|
@@ -1230,8 +1284,7 @@ get_all_entries (void)
|
||||||
|
{
|
||||||
|
struct mount_entry *me;
|
||||||
|
|
||||||
|
- if (!show_all_fs)
|
||||||
|
- filter_mount_list ();
|
||||||
|
+ filter_mount_list (show_all_fs);
|
||||||
|
|
||||||
|
for (me = mount_list; me; me = me->me_next)
|
||||||
|
get_dev (me->me_devname, me->me_mountdir, NULL, NULL, me->me_type,
|
||||||
|
Index: coreutils-8.22/tests/df/skip-duplicates.sh
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/tests/df/skip-duplicates.sh 2014-07-26 00:02:00.468872150 +0200
|
||||||
|
+++ coreutils-8.22/tests/df/skip-duplicates.sh 2014-07-26 00:02:00.485871937 +0200
|
||||||
|
@@ -96,8 +96,8 @@ test -f x || skip_ "internal test failur
|
||||||
|
LD_PRELOAD=./k.so df -T >out || fail=1
|
||||||
|
test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
-# Ensure we fail when unable to stat invalid entries
|
||||||
|
-LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1 df -T >out && fail=1
|
||||||
|
+# Ensure we don't fail when unable to stat (currently) unavailable entries
|
||||||
|
+LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1 df -T >out || fail=1
|
||||||
|
test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# df should also prefer "/fsname" over "fsname"
|
||||||
|
@@ -113,6 +113,8 @@ test $(grep -c 'virtfs2.*fstype2' <out)
|
||||||
|
# Ensure that filtering duplicates does not affect -a processing.
|
||||||
|
LD_PRELOAD=./k.so df -a >out || fail=1
|
||||||
|
test $(wc -l <out) -eq 6 || { fail=1; cat out; }
|
||||||
|
+# Ensure placeholder "-" values used for the eclipsed "virtfs"
|
||||||
|
+test $(grep -c 'virtfs *-' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure that filtering duplicates does not affect
|
||||||
|
# argument processing (now without the fake getmntent()).
|
@ -0,0 +1,200 @@
|
|||||||
|
commit d71c12f1e4e165c7da59989b49ded2805b7977cc
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Tue Jun 24 15:34:39 2014 +0100
|
||||||
|
|
||||||
|
df: report correct device in presence of eclipsed mounts
|
||||||
|
|
||||||
|
* src/df.c (last_device_for_mount): A new function to identify
|
||||||
|
the last device mounted for a mount point.
|
||||||
|
(get_disk): Use the above to discard mount entries for a device,
|
||||||
|
where a later mount entry uses a different device name than
|
||||||
|
that of the user specified device.
|
||||||
|
* tests/df/over-mount-device.sh: A new root test.
|
||||||
|
* tests/local.mk: Reference the new test.
|
||||||
|
* NEWS: Reword for all these related recent fixes.
|
||||||
|
Discussed at: http://bugs.gnu.org/16539#69
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 9 +++---
|
||||||
|
src/df.c | 42 ++++++++++++++++++++++++++++++
|
||||||
|
tests/df/over-mount-device.sh | 57 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
tests/local.mk | 1
|
||||||
|
4 files changed, 104 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
Index: coreutils-8.22/NEWS
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/NEWS 2014-07-26 00:03:09.335011204 +0200
|
||||||
|
+++ coreutils-8.22/NEWS 2014-07-26 00:03:30.216750147 +0200
|
||||||
|
@@ -2,10 +2,11 @@ GNU coreutils NEWS
|
||||||
|
|
||||||
|
Changes done after the release of 8.22
|
||||||
|
|
||||||
|
- df now elides duplicates for virtual file systems like tmpfs.
|
||||||
|
- Displays the correct device details for points mounted multiple times.
|
||||||
|
- Displays placeholder values for inaccessible file systems,
|
||||||
|
- rather than error messages or values for the wrong file system.
|
||||||
|
+ df has more fixes related to the newer dynamic representation of file systems:
|
||||||
|
+ Duplicates are elided for virtual file systems like tmpfs.
|
||||||
|
+ Details for the correct device are output for points mounted multiple times.
|
||||||
|
+ Placeholder values are output for inaccessible file systems, rather than
|
||||||
|
+ than error messages or values for the wrong file system.
|
||||||
|
[These bugs were present in "the beginning".]
|
||||||
|
|
||||||
|
Noteworthy changes in release 8.22 (2013-12-13) [stable]
|
||||||
|
Index: coreutils-8.22/src/df.c
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/src/df.c 2014-07-26 00:03:09.327011304 +0200
|
||||||
|
+++ coreutils-8.22/src/df.c 2014-07-26 00:03:09.335011204 +0200
|
||||||
|
@@ -1114,6 +1114,33 @@ get_dev (char const *disk, char const *m
|
||||||
|
free (dev_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Scan the mount list returning the _last_ device found for MOUNT.
|
||||||
|
+ NULL is returned if MOUNT not found. The result is malloced. */
|
||||||
|
+static char *
|
||||||
|
+last_device_for_mount (char const* mount)
|
||||||
|
+{
|
||||||
|
+ struct mount_entry const *me;
|
||||||
|
+ struct mount_entry const *le = NULL;
|
||||||
|
+
|
||||||
|
+ for (me = mount_list; me; me = me->me_next)
|
||||||
|
+ {
|
||||||
|
+ if (STREQ (me->me_mountdir, mount))
|
||||||
|
+ le = me;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (le)
|
||||||
|
+ {
|
||||||
|
+ char *devname = le->me_devname;
|
||||||
|
+ char *canon_dev = canonicalize_file_name (devname);
|
||||||
|
+ if (canon_dev && IS_ABSOLUTE_FILE_NAME (canon_dev))
|
||||||
|
+ return canon_dev;
|
||||||
|
+ free (canon_dev);
|
||||||
|
+ return xstrdup (le->me_devname);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* If DISK corresponds to a mount point, show its usage
|
||||||
|
and return true. Otherwise, return false. */
|
||||||
|
static bool
|
||||||
|
@@ -1122,6 +1149,7 @@ get_disk (char const *disk)
|
||||||
|
struct mount_entry const *me;
|
||||||
|
struct mount_entry const *best_match = NULL;
|
||||||
|
bool best_match_accessible = false;
|
||||||
|
+ bool eclipsed_device = false;
|
||||||
|
char const *file = disk;
|
||||||
|
|
||||||
|
char *resolved = canonicalize_file_name (disk);
|
||||||
|
@@ -1139,9 +1167,12 @@ get_disk (char const *disk)
|
||||||
|
|
||||||
|
if (STREQ (disk, devname))
|
||||||
|
{
|
||||||
|
+ char *last_device = last_device_for_mount (me->me_mountdir);
|
||||||
|
+ eclipsed_device = last_device && ! STREQ (last_device, devname);
|
||||||
|
size_t len = strlen (me->me_mountdir);
|
||||||
|
|
||||||
|
- if (! best_match_accessible || len < best_match_len)
|
||||||
|
+ if (! eclipsed_device
|
||||||
|
+ && (! best_match_accessible || len < best_match_len))
|
||||||
|
{
|
||||||
|
struct stat disk_stats;
|
||||||
|
bool this_match_accessible = false;
|
||||||
|
@@ -1159,6 +1190,8 @@ get_disk (char const *disk)
|
||||||
|
best_match_len = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ free (last_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (canon_dev);
|
||||||
|
@@ -1173,6 +1206,13 @@ get_disk (char const *disk)
|
||||||
|
best_match->me_remote, NULL, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
+ else if (eclipsed_device)
|
||||||
|
+ {
|
||||||
|
+ error (0, 0, _("cannot access %s: over-mounted by another device"),
|
||||||
|
+ quote (file));
|
||||||
|
+ exit_status = EXIT_FAILURE;
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Index: coreutils-8.22/tests/df/over-mount-device.sh
|
||||||
|
===================================================================
|
||||||
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ coreutils-8.22/tests/df/over-mount-device.sh 2014-07-26 00:03:09.335011204 +0200
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+# Ensure that df /dev/loop0 errors out if overmounted by another device
|
||||||
|
+
|
||||||
|
+# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+# This program is free software: you can redistribute it and/or modify
|
||||||
|
+# it under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+
|
||||||
|
+# This program is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+# GNU General Public License for more details.
|
||||||
|
+
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||||
|
+print_ver_ df
|
||||||
|
+require_root_
|
||||||
|
+
|
||||||
|
+cwd=$(pwd)
|
||||||
|
+cleanup_() { cd /; umount "$cwd/mnt"; umount "$cwd/mnt"; }
|
||||||
|
+
|
||||||
|
+skip=0
|
||||||
|
+
|
||||||
|
+# Create 2 file systems
|
||||||
|
+for i in 1 2; do
|
||||||
|
+ dd if=/dev/zero of=blob$i bs=8192 count=200 > /dev/null 2>&1 \
|
||||||
|
+ || skip=1
|
||||||
|
+ mkfs -t ext2 -F blob$i \
|
||||||
|
+ || skip_ "failed to create ext2 file system"
|
||||||
|
+done
|
||||||
|
+
|
||||||
|
+# Mount both at the same place (eclipsing the first)
|
||||||
|
+mkdir mnt || skip=1
|
||||||
|
+mount -oloop blob1 mnt || skip=1
|
||||||
|
+eclipsed_dev=$(df --o=source mnt | tail -n1) || skip=1
|
||||||
|
+mount -oloop blob2 mnt || skip=1
|
||||||
|
+
|
||||||
|
+test $skip = 1 \
|
||||||
|
+ && skip_ "insufficient mount/ext2 support"
|
||||||
|
+
|
||||||
|
+df . || skip_ "failed to lookup the device for the current dir"
|
||||||
|
+
|
||||||
|
+echo "df: cannot access '$eclipsed_dev': over-mounted by another device" > exp
|
||||||
|
+
|
||||||
|
+# We should get an error for the eclipsed device and continue
|
||||||
|
+df $eclipsed_dev . > out 2> err && fail=1
|
||||||
|
+
|
||||||
|
+# header and single entry in output
|
||||||
|
+test $(wc -l < out) = 2 || fail=1
|
||||||
|
+
|
||||||
|
+compare exp err || fail=1
|
||||||
|
+
|
||||||
|
+Exit $fail
|
||||||
|
Index: coreutils-8.22/tests/local.mk
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/tests/local.mk 2014-07-26 00:03:09.203012855 +0200
|
||||||
|
+++ coreutils-8.22/tests/local.mk 2014-07-26 00:03:09.335011204 +0200
|
||||||
|
@@ -115,6 +115,7 @@ all_root_tests = \
|
||||||
|
tests/cp/sparse-fiemap.sh \
|
||||||
|
tests/dd/skip-seek-past-dev.sh \
|
||||||
|
tests/df/problematic-chars.sh \
|
||||||
|
+ tests/df/over-mount-device.sh \
|
||||||
|
tests/du/bind-mount-dir-cycle.sh \
|
||||||
|
tests/id/setgid.sh \
|
||||||
|
tests/install/install-C-root.sh \
|
@ -1,3 +1,23 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 25 23:48:47 CEST 2014 - pth@suse.de
|
||||||
|
|
||||||
|
- Incorporate 9 bugfixes, one documentation update and two maintenance
|
||||||
|
patches that won't harm (bnc#888215), See NEWS for specifics:
|
||||||
|
|
||||||
|
coreutils-improve_df_--human_and_--si,_help_and_man_page.patch
|
||||||
|
coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
|
||||||
|
coreutils-also_deduplicate_virtual_file_systems.patch
|
||||||
|
coreutils-fix_handling_of_symlinks_in_mount_list.patch
|
||||||
|
coreutils-ignore_non_file_system_entries_in_proc_mounts.patch
|
||||||
|
coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
|
||||||
|
coreutils-use_the_last_device_name_provided_by_the_system.patch
|
||||||
|
coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch
|
||||||
|
coreutils-use_all_of_the_last_device_details_provided.patch
|
||||||
|
coreutils-output_placeholder_values_for_inaccessible_mount_points.patch
|
||||||
|
coreutils-look_for_accessible_mount_points_for_specified_devices.patch
|
||||||
|
coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch
|
||||||
|
coreutils-avoid_an_inconsequential_mem_leak.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 16 20:38:48 UTC 2014 - mail@bernhard-voelker.de
|
Sun Mar 16 20:38:48 UTC 2014 - mail@bernhard-voelker.de
|
||||||
|
|
||||||
|
@ -142,6 +142,23 @@ Patch306: coreutils-date-avoid-crash-in-TZ-parsing.patch
|
|||||||
# shuf --repeat no longer dumps core if the input is empty.
|
# shuf --repeat no longer dumps core if the input is empty.
|
||||||
Patch307: coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
|
Patch307: coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
|
||||||
|
|
||||||
|
# These arte all upstream fixes that will be part of the upcoming 8.23
|
||||||
|
# and can thus be removed on updating the package.
|
||||||
|
|
||||||
|
Patch401: coreutils-improve_df_--human_and_--si,_help_and_man_page.patch
|
||||||
|
Patch402: coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
|
||||||
|
Patch403: coreutils-also_deduplicate_virtual_file_systems.patch
|
||||||
|
Patch404: coreutils-fix_handling_of_symlinks_in_mount_list.patch
|
||||||
|
Patch405: coreutils-ignore_non_file_system_entries_in_proc_mounts.patch
|
||||||
|
Patch406: coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
|
||||||
|
Patch407: coreutils-use_the_last_device_name_provided_by_the_system.patch
|
||||||
|
Patch408: coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch
|
||||||
|
Patch409: coreutils-use_all_of_the_last_device_details_provided.patch
|
||||||
|
Patch410: coreutils-output_placeholder_values_for_inaccessible_mount_points.patch
|
||||||
|
Patch411: coreutils-look_for_accessible_mount_points_for_specified_devices.patch
|
||||||
|
Patch412: coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch
|
||||||
|
Patch413: coreutils-avoid_an_inconsequential_mem_leak.patch
|
||||||
|
|
||||||
# ================================================
|
# ================================================
|
||||||
%description
|
%description
|
||||||
These are the GNU core utilities. This package is the union of
|
These are the GNU core utilities. This package is the union of
|
||||||
@ -187,6 +204,20 @@ the GNU fileutils, sh-utils, and textutils packages.
|
|||||||
%patch306
|
%patch306
|
||||||
%patch307
|
%patch307
|
||||||
|
|
||||||
|
%patch401 -p1
|
||||||
|
%patch402 -p1
|
||||||
|
%patch403 -p1
|
||||||
|
%patch404 -p1
|
||||||
|
%patch405 -p1
|
||||||
|
%patch406 -p1
|
||||||
|
%patch407 -p1
|
||||||
|
%patch408 -p1
|
||||||
|
%patch409 -p1
|
||||||
|
%patch410 -p1
|
||||||
|
%patch411 -p1
|
||||||
|
%patch412 -p1
|
||||||
|
%patch413 -p1
|
||||||
|
|
||||||
#???## We need to statically link to gmp, otherwise we have a build loop
|
#???## We need to statically link to gmp, otherwise we have a build loop
|
||||||
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
|
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
|
||||||
|
|
||||||
|
97
coreutils-use_all_of_the_last_device_details_provided.patch
Normal file
97
coreutils-use_all_of_the_last_device_details_provided.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
commit 4f8d74eb1b2ba17ef05f81c1c725e60a65cf8293
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Tue Jun 17 00:18:47 2014 +0100
|
||||||
|
|
||||||
|
df: use all of the last device details provided
|
||||||
|
|
||||||
|
* src/df.c (filter_mount_list): Recent commit v8.22-108-g25a2c94
|
||||||
|
failed to copy file system type along with the updated device name.
|
||||||
|
Therefore simply replace the existing mount entry with the
|
||||||
|
current one with all the latest device details. Note the name,
|
||||||
|
even if not shorter in this entry, will be replaced with a shorter
|
||||||
|
name in a subsequent mount entry.
|
||||||
|
* tests/df/skip-duplicates.sh: Add a test case.
|
||||||
|
|
||||||
|
diff --git a/src/df.c b/src/df.c
|
||||||
|
index 747d138..10047ce 100644
|
||||||
|
--- a/src/df.c
|
||||||
|
+++ b/src/df.c
|
||||||
|
@@ -642,7 +642,9 @@ filter_mount_list (void)
|
||||||
|
if ((strchr (me->me_devname, '/')
|
||||||
|
&& ! strchr (devlist->me->me_devname, '/'))
|
||||||
|
|| (strlen (devlist->me->me_mountdir)
|
||||||
|
- > strlen (me->me_mountdir)))
|
||||||
|
+ > strlen (me->me_mountdir))
|
||||||
|
+ /* or one overmounted on a different device. */
|
||||||
|
+ || ! STREQ (devlist->me->me_devname, me->me_devname))
|
||||||
|
{
|
||||||
|
/* Discard mount entry for existing device. */
|
||||||
|
discard_me = devlist->me;
|
||||||
|
@@ -652,17 +654,6 @@ filter_mount_list (void)
|
||||||
|
{
|
||||||
|
/* Discard mount entry currently being processed. */
|
||||||
|
discard_me = me;
|
||||||
|
-
|
||||||
|
- /* We might still want the devname from this mount entry as
|
||||||
|
- the dev_num might not correlate with st_dev if another
|
||||||
|
- device is subsequently overmounted at mountdir, so honor
|
||||||
|
- the order of the presented list and replace with the
|
||||||
|
- latest devname encountered. */
|
||||||
|
- if (! STREQ (devlist->me->me_devname, me->me_devname))
|
||||||
|
- {
|
||||||
|
- free (devlist->me->me_devname);
|
||||||
|
- devlist->me->me_devname = xstrdup (me->me_devname);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
|
||||||
|
index 6fb6ff5..a620e73 100755
|
||||||
|
--- a/tests/df/skip-duplicates.sh
|
||||||
|
+++ b/tests/df/skip-duplicates.sh
|
||||||
|
@@ -54,8 +54,8 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
{.mnt_fsname="fsname", .mnt_dir="/",},
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/."},
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/"},
|
||||||
|
- {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
- {.mnt_fsname="virtfs2", .mnt_dir="/NONROOT"},
|
||||||
|
+ {.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]"},
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -71,7 +71,8 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
|
||||||
|
while (done++ <= 7)
|
||||||
|
{
|
||||||
|
- mntents[done-2].mnt_type = "-";
|
||||||
|
+ 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;
|
||||||
|
return &mntents[done-2];
|
||||||
|
@@ -92,11 +93,11 @@ test -f x || skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
|
||||||
|
# The fake mtab file should only contain entries
|
||||||
|
# having the same device number; thus the output should
|
||||||
|
# consist of a header and unique entries.
|
||||||
|
-LD_PRELOAD=./k.so df >out || fail=1
|
||||||
|
+LD_PRELOAD=./k.so df -T >out || fail=1
|
||||||
|
test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure we fail when unable to stat invalid entries
|
||||||
|
-LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1 df >out && fail=1
|
||||||
|
+LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1 df -T >out && fail=1
|
||||||
|
test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# df should also prefer "/fsname" over "fsname"
|
||||||
|
@@ -106,8 +107,8 @@ if test "$unique_entries" = 2; then
|
||||||
|
test $(grep -cF '/.' <out) -eq 0 || { fail=1; cat out; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
-# df should use the last seen devname (mnt_fsname)
|
||||||
|
-test $(grep -c 'virtfs2' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
+# df should use the last seen devname (mnt_fsname) and devtype (mnt_type)
|
||||||
|
+test $(grep -c 'virtfs2.*fstype2' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure that filtering duplicates does not affect -a processing.
|
||||||
|
LD_PRELOAD=./k.so df -a >out || fail=1
|
120
coreutils-use_the_last_device_name_provided_by_the_system.patch
Normal file
120
coreutils-use_the_last_device_name_provided_by_the_system.patch
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
commit 25a2c948b24163ce0e0e9e52f6a5fef33d7d7842
|
||||||
|
Author: Pádraig Brady <P@draigBrady.com>
|
||||||
|
Date: Thu May 29 15:30:46 2014 +0100
|
||||||
|
|
||||||
|
df: use the last device name provided by the system
|
||||||
|
|
||||||
|
The device name reported for a particular mount entry
|
||||||
|
may no longer be valid if the mount point was subsequently
|
||||||
|
mounted on a different device. Therefore honor the order
|
||||||
|
of the mount list returned by the system and use the last
|
||||||
|
reported device name.
|
||||||
|
|
||||||
|
* src/df.c (filter_mount_list): When discarding the current
|
||||||
|
mount entry, ensure that a new device name is not also discarded.
|
||||||
|
* tests/df/skip-duplicates.sh: Add a test case. Also fix
|
||||||
|
a false failure in the edge case of a system with only a
|
||||||
|
single file system.
|
||||||
|
* NEWS: Mention the fix.
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 4 +++-
|
||||||
|
src/df.c | 22 +++++++++++++++++++---
|
||||||
|
tests/df/skip-duplicates.sh | 13 +++++++++----
|
||||||
|
3 files changed, 31 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
Index: coreutils-8.22/NEWS
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/NEWS 2014-07-26 00:00:59.716631657 +0200
|
||||||
|
+++ coreutils-8.22/NEWS 2014-07-26 00:01:35.008190452 +0200
|
||||||
|
@@ -2,7 +2,9 @@ GNU coreutils NEWS
|
||||||
|
|
||||||
|
Changes done after the release of 8.22
|
||||||
|
|
||||||
|
- df now correctly elides duplicates for virtual file systems like tmpfs.
|
||||||
|
+ df now elides duplicates for virtual file systems like tmpfs, and will
|
||||||
|
+ display the correct device name for directories mounted multiple times.
|
||||||
|
+ [These bugs were present in "the beginning".]
|
||||||
|
|
||||||
|
Noteworthy changes in release 8.22 (2013-12-13) [stable]
|
||||||
|
|
||||||
|
Index: coreutils-8.22/src/df.c
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/src/df.c 2014-07-26 00:00:59.711631720 +0200
|
||||||
|
+++ coreutils-8.22/src/df.c 2014-07-26 00:00:59.716631657 +0200
|
||||||
|
@@ -604,7 +604,7 @@ excluded_fstype (const char *fstype)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter mount list by skipping duplicate entries.
|
||||||
|
- In the case of duplicities - based on to the device number - the mount entry
|
||||||
|
+ In the case of duplicities - based on the device number - the mount entry
|
||||||
|
with a '/' in its me_devname (i.e. not pseudo name like tmpfs) wins.
|
||||||
|
If both have a real devname (e.g. bind mounts), then that with the shorter
|
||||||
|
me_mountdir wins. */
|
||||||
|
@@ -638,17 +638,33 @@ filter_mount_list (void)
|
||||||
|
|
||||||
|
if (devlist)
|
||||||
|
{
|
||||||
|
- discard_me = me;
|
||||||
|
-
|
||||||
|
/* ...let the shorter mountdir win. */
|
||||||
|
if ((strchr (me->me_devname, '/')
|
||||||
|
&& ! strchr (devlist->me->me_devname, '/'))
|
||||||
|
|| (strlen (devlist->me->me_mountdir)
|
||||||
|
> strlen (me->me_mountdir)))
|
||||||
|
{
|
||||||
|
+ /* Discard mount entry for existing device. */
|
||||||
|
discard_me = devlist->me;
|
||||||
|
devlist->me = me;
|
||||||
|
}
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ /* Discard mount entry currently being processed. */
|
||||||
|
+ discard_me = me;
|
||||||
|
+
|
||||||
|
+ /* We might still want the devname from this mount entry as
|
||||||
|
+ the dev_num might not correlate with st_dev if another
|
||||||
|
+ device is subsequently overmounted at mountdir, so honor
|
||||||
|
+ the order of the presented list and replace with the
|
||||||
|
+ latest devname encountered. */
|
||||||
|
+ if (! STREQ (devlist->me->me_devname, me->me_devname))
|
||||||
|
+ {
|
||||||
|
+ free (devlist->me->me_devname);
|
||||||
|
+ devlist->me->me_devname = xstrdup (me->me_devname);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Index: coreutils-8.22/tests/df/skip-duplicates.sh
|
||||||
|
===================================================================
|
||||||
|
--- coreutils-8.22.orig/tests/df/skip-duplicates.sh 2014-07-26 00:00:59.706631782 +0200
|
||||||
|
+++ coreutils-8.22/tests/df/skip-duplicates.sh 2014-07-26 00:00:59.716631657 +0200
|
||||||
|
@@ -55,7 +55,7 @@ struct mntent *getmntent (FILE *fp)
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/."},
|
||||||
|
{.mnt_fsname="/fsname", .mnt_dir="/"},
|
||||||
|
{.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
- {.mnt_fsname="virtfs", .mnt_dir="/NONROOT"},
|
||||||
|
+ {.mnt_fsname="virtfs2", .mnt_dir="/NONROOT"},
|
||||||
|
{.mnt_fsname="netns", .mnt_dir="net:[1234567]"},
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -100,9 +100,14 @@ LD_PRELOAD=./k.so CU_TEST_DUPE_INVALID=1
|
||||||
|
test $(wc -l <out) -eq $(expr 1 + $unique_entries) || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# df should also prefer "/fsname" over "fsname"
|
||||||
|
-test $(grep -c '/fsname' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
-# ... and "/fsname" with '/' as Mounted on over '/.'
|
||||||
|
-test $(grep -cF '/.' <out) -eq 0 || { fail=1; cat out; }
|
||||||
|
+if test "$unique_entries" = 2; then
|
||||||
|
+ test $(grep -c '/fsname' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
+ # ... and "/fsname" with '/' as Mounted on over '/.'
|
||||||
|
+ test $(grep -cF '/.' <out) -eq 0 || { fail=1; cat out; }
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# df should use the last seen devname (mnt_fsname)
|
||||||
|
+test $(grep -c 'virtfs2' <out) -eq 1 || { fail=1; cat out; }
|
||||||
|
|
||||||
|
# Ensure that filtering duplicates does not affect -a processing.
|
||||||
|
LD_PRELOAD=./k.so df -a >out || fail=1
|
@ -1,3 +1,23 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 25 23:48:47 CEST 2014 - pth@suse.de
|
||||||
|
|
||||||
|
- Incorporate 9 bugfixes, one documentation update and two maintenance
|
||||||
|
patches that won't harm (bnc#888215), See NEWS for specifics:
|
||||||
|
|
||||||
|
coreutils-improve_df_--human_and_--si,_help_and_man_page.patch
|
||||||
|
coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
|
||||||
|
coreutils-also_deduplicate_virtual_file_systems.patch
|
||||||
|
coreutils-fix_handling_of_symlinks_in_mount_list.patch
|
||||||
|
coreutils-ignore_non_file_system_entries_in_proc_mounts.patch
|
||||||
|
coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
|
||||||
|
coreutils-use_the_last_device_name_provided_by_the_system.patch
|
||||||
|
coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch
|
||||||
|
coreutils-use_all_of_the_last_device_details_provided.patch
|
||||||
|
coreutils-output_placeholder_values_for_inaccessible_mount_points.patch
|
||||||
|
coreutils-look_for_accessible_mount_points_for_specified_devices.patch
|
||||||
|
coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch
|
||||||
|
coreutils-avoid_an_inconsequential_mem_leak.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 16 20:38:48 UTC 2014 - mail@bernhard-voelker.de
|
Sun Mar 16 20:38:48 UTC 2014 - mail@bernhard-voelker.de
|
||||||
|
|
||||||
|
@ -142,6 +142,23 @@ Patch306: coreutils-date-avoid-crash-in-TZ-parsing.patch
|
|||||||
# shuf --repeat no longer dumps core if the input is empty.
|
# shuf --repeat no longer dumps core if the input is empty.
|
||||||
Patch307: coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
|
Patch307: coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
|
||||||
|
|
||||||
|
# These arte all upstream fixes that will be part of the upcoming 8.23
|
||||||
|
# and can thus be removed on updating the package.
|
||||||
|
|
||||||
|
Patch401: coreutils-improve_df_--human_and_--si,_help_and_man_page.patch
|
||||||
|
Patch402: coreutils-avoid_sizeof_charPP__static_analysis_warning.patch
|
||||||
|
Patch403: coreutils-also_deduplicate_virtual_file_systems.patch
|
||||||
|
Patch404: coreutils-fix_handling_of_symlinks_in_mount_list.patch
|
||||||
|
Patch405: coreutils-ignore_non_file_system_entries_in_proc_mounts.patch
|
||||||
|
Patch406: coreutils-avoid_clang_-Wtautological-constant-out-of-range-compare_warning.patch
|
||||||
|
Patch407: coreutils-use_the_last_device_name_provided_by_the_system.patch
|
||||||
|
Patch408: coreutils-avoid_compiler_warnings_with_some_assert_implementations.patch
|
||||||
|
Patch409: coreutils-use_all_of_the_last_device_details_provided.patch
|
||||||
|
Patch410: coreutils-output_placeholder_values_for_inaccessible_mount_points.patch
|
||||||
|
Patch411: coreutils-look_for_accessible_mount_points_for_specified_devices.patch
|
||||||
|
Patch412: coreutils-report_correct_device_in_presence_of_eclipsed_mounts.patch
|
||||||
|
Patch413: coreutils-avoid_an_inconsequential_mem_leak.patch
|
||||||
|
|
||||||
# ================================================
|
# ================================================
|
||||||
%description
|
%description
|
||||||
These are the GNU core utilities. This package is the union of
|
These are the GNU core utilities. This package is the union of
|
||||||
@ -187,6 +204,20 @@ the GNU fileutils, sh-utils, and textutils packages.
|
|||||||
%patch306
|
%patch306
|
||||||
%patch307
|
%patch307
|
||||||
|
|
||||||
|
%patch401 -p1
|
||||||
|
%patch402 -p1
|
||||||
|
%patch403 -p1
|
||||||
|
%patch404 -p1
|
||||||
|
%patch405 -p1
|
||||||
|
%patch406 -p1
|
||||||
|
%patch407 -p1
|
||||||
|
%patch408 -p1
|
||||||
|
%patch409 -p1
|
||||||
|
%patch410 -p1
|
||||||
|
%patch411 -p1
|
||||||
|
%patch412 -p1
|
||||||
|
%patch413 -p1
|
||||||
|
|
||||||
#???## We need to statically link to gmp, otherwise we have a build loop
|
#???## We need to statically link to gmp, otherwise we have a build loop
|
||||||
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
|
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user