Accepting request 243413 from home:bernhard-voelker:branches:Base:System

Upgrade to coreutils-8.23

OBS-URL: https://build.opensuse.org/request/show/243413
OBS-URL: https://build.opensuse.org/package/show/Base:System/coreutils?expand=0&rev=234
This commit is contained in:
Bernhard Voelker 2014-08-01 16:10:23 +00:00 committed by Git OBS Bridge
parent 9a063f8a1f
commit 1fe8c32170
37 changed files with 976 additions and 1981 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212
size 5335124

3
coreutils-8.23.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ec43ca5bcfc62242accb46b7f121f6b684ee21ecd7d075059bf650ff9e37b82d
size 5375612

View File

@ -1,186 +0,0 @@
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()).

View File

@ -1,44 +0,0 @@
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;
}

View File

@ -1,42 +0,0 @@
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);

View File

@ -1,35 +0,0 @@
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");
}

View File

@ -1,22 +0,0 @@
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 *));
}

View File

@ -27,7 +27,7 @@ Index: src/local.mk
# The list of all programs (separated in different variables to express
# the how and when they should be installed) is defined in this makefile
@@ -271,6 +271,9 @@ src_factor_LDADD += $(LIB_GMP)
@@ -276,6 +276,9 @@ src_factor_LDADD += $(LIB_GMP)
# for getloadavg
src_uptime_LDADD += $(GETLOADAVG_LIBS)

View File

@ -0,0 +1,455 @@
# Upstream patch on top of v8.23 (to be removed in v8.24):
# https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=0cf7b1d9
# Fixes a regression in chroot which did not chdir("/") in all cases.
From 0c7abd9e8e1d1725ae600daa3ac9bbf8333f93c9 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Fri, 1 Aug 2014 02:07:33 +0200
Subject: [PATCH] chroot: perform chdir("/") again unless new --skip-chdir is
specified
Since commit v8.22-94-g99960ee, chroot(1) skips the chroot(2) syscall
for "/" arguments (and synonyms). The problem is that it also skips
the following chdir("/") call in that case. The latter breaks existing
scripts which expect "/" to be the working directory inside the chroot.
While the first part of the change - i.e., skipping chroot("/") - is
okay for consistency with systems where it might succeed for a non-root
user, the second part might be malicious, e.g.
cd /home/user && chroot '/' bin/foo
In the "best" case, chroot(1) could not execute 'bin/foo' with ENOENT,
but in the worst case, chroot(1) would execute '/home/user/bin/foo' in
the case that exists - instead of '/bin/foo'.
Revert that second part of the patch, i.e., perform the chdir("/)
in the common case again - unless the new --skip-chdir option is
specified. Restrict this new option to the case of "/" arguments.
* src/chroot.c (SKIP_CHDIR): Add enum.
(long_opts): Add entry for the new --skip-chdir option.
(usage): Add --skip-chdir option, and while at it, move the other
to options into alphabetical order.
(main): Accept the above new option, allowing it only in the case
when NEWROOT is the old "/".
Move down the chdir() call after the if-clause to ensure it is
run in any case - unless --skip-chdir is specified.
Add a 'newroot' variable for the new root directory as it is used
in a couple of places now.
* tests/misc/chroot-fail.sh: Invert the last tests which check the
working directory of the execvp()ed program when a "/"-like
argument was passed: now expect it to be "/" - unless --skip-chdir
is given.
* doc/coreutils.texi (chroot invocation): Document the new option.
Document that chroot(1) usually calls chdir("/") unless the new
--skip-chdir option is specified. Sort options.
* NEWS (Changes in behavior): Mention the fix.
(New features): Mention the new option.
* init.cfg (nonroot_has_perm_): Add chroot's new --skip-chdir option.
* tests/cp/preserve-gid.sh (t1): Likewise.
* tests/cp/special-bits.sh: Likewise.
* tests/id/setgid.sh: Likewise.
* tests/misc/truncate-owned-by-other.sh: Likewise.
* tests/mv/sticky-to-xpart.sh: Likewise.
* tests/rm/fail-2eperm.sh: Likewise.
* tests/rm/no-give-up.sh: Likewise.
* tests/touch/now-owned-by-other.sh: Likewise.
Reported by Andreas Schwab in http://bugs.gnu.org/18062
---
NEWS | 13 +++++++++++
doc/coreutils.texi | 36 +++++++++++++++++++++-----------
init.cfg | 3 +-
src/chroot.c | 38 ++++++++++++++++++++++++++--------
tests/cp/preserve-gid.sh | 3 +-
tests/cp/special-bits.sh | 3 +-
tests/id/setgid.sh | 8 +++----
tests/misc/chroot-fail.sh | 23 +++++++++++++++++---
tests/misc/truncate-owned-by-other.sh | 2 -
tests/mv/sticky-to-xpart.sh | 5 ++--
tests/rm/fail-2eperm.sh | 6 +++--
tests/rm/no-give-up.sh | 2 -
tests/touch/now-owned-by-other.sh | 2 -
13 files changed, 106 insertions(+), 38 deletions(-)
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -172,6 +172,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.
+** New features
+
+ chroot accepts the new --skip-chdir option to not change the working directory
+ to "/" after changing into the chroot(2) jail, thus retaining the current wor-
+ king directory. The new option is only permitted if the new root directory is
+ the old "/", and therefore is useful with the --group and --userspec options.
+
+** Changes in behavior
+
+ chroot changes the current directory to "/" in again - unless the above new
+ --skip-chdir option is specified.
+ [bug introduced in coreutils-8.23]
+
* Noteworthy changes in release 8.22 (2013-12-13) [stable]
Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -16068,7 +16068,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
-underlying function is non-privileged due to lack of support in MS-Windows.}
+underlying function is non-privileged due to lack of support in MS-Windows.
+Furthermore, the @command{chroot} command avoids the @code{chroot} system call
+when @var{newroot} is identical to the old @file{/} directory for consistency
+with systems where this is allowed for non-privileged users.}.
Synopses:
@example
@@ -16078,10 +16081,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
-the directory @var{newroot} (which must exist) and then runs
-@var{command} with optional @var{args}. If @var{command} is not
-specified, the default is the value of the @env{SHELL} environment
-variable or @command{/bin/sh} if not set, invoked with the @option{-i} option.
+the directory @var{newroot} (which must exist), then changes the working
+directory to @file{/}, and finally runs @var{command} with optional @var{args}.
+If @var{command} is not specified, the default is the value of the @env{SHELL}
+environment variable or @command{/bin/sh} if not set, invoked with the
+@option{-i} option.
@var{command} must not be a special built-in utility
(@pxref{Special built-in utilities}).
@@ -16090,6 +16094,14 @@ Options must precede operands.
@table @samp
+@item --groups=@var{groups}
+@opindex --groups
+Use this option to override the supplementary @var{groups} to be
+used by the new process.
+The items in the list (names or numeric IDs) must be separated by commas.
+Use @samp{--groups=''} to disable the supplementary group look-up
+implicit in the @option{--userspec} option.
+
@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
are set according to the system defined list for that user,
unless overridden with the @option{--groups} option.
-@item --groups=@var{groups}
-@opindex --groups
-Use this option to override the supplementary @var{groups} to be
-used by the new process.
-The items in the list (names or numeric IDs) must be separated by commas.
-Use @samp{--groups=''} to disable the supplementary group look-up
-implicit in the @option{--userspec} option.
+@item --skip-chdir
+@opindex --skip-chdir
+Use this option to not change the working directory to @file{/} after changing
+the root directory to @var{newroot}, i.e., inside the chroot.
+This option is only permitted when @var{newroot} is the old @file{/} directory,
+and therefore is mostly useful together with the @option{--groups} and
+@option{--userspec} options to retain the previous working directory.
@end table
Index: init.cfg
===================================================================
--- init.cfg.orig
+++ init.cfg
@@ -400,7 +400,8 @@ nonroot_has_perm_()
require_built_ chroot
local rm_version=$(
- chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" rm --version |
+ chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+ rm --version |
sed -n '1s/.* //p'
)
case ":$rm_version:" in
Index: src/chroot.c
===================================================================
--- src/chroot.c.orig
+++ src/chroot.c
@@ -49,13 +49,15 @@ static inline bool gid_unset (gid_t gid)
enum
{
GROUPS = UCHAR_MAX + 1,
- USERSPEC
+ USERSPEC,
+ SKIP_CHDIR
};
static struct option const long_opts[] =
{
{"groups", required_argument, NULL, GROUPS},
{"userspec", required_argument, NULL, USERSPEC},
+ {"skip-chdir", no_argument, NULL, SKIP_CHDIR},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
@@ -194,9 +196,14 @@ Run COMMAND with root directory set to N
"), stdout);
fputs (_("\
- --userspec=USER:GROUP specify user and group (ID or name) to use\n\
--groups=G_LIST specify supplementary groups as g1,g2,..,gN\n\
"), stdout);
+ fputs (_("\
+ --userspec=USER:GROUP specify user and group (ID or name) to use\n\
+"), stdout);
+ printf (_("\
+ --skip-chdir do not change working directory to %s\n\
+"), quote ("/"));
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -218,6 +225,7 @@ main (int argc, char **argv)
char *userspec = NULL;
char const *username = NULL;
char const *groups = NULL;
+ bool skip_chdir = false;
/* Parsed user and group IDs. */
uid_t uid = -1;
@@ -254,6 +262,10 @@ main (int argc, char **argv)
groups = optarg;
break;
+ case SKIP_CHDIR:
+ skip_chdir = true;
+ break;
+
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
@@ -269,9 +281,19 @@ main (int argc, char **argv)
usage (EXIT_CANCELED);
}
+ char const *newroot = argv[optind];
+ bool is_oldroot = is_root (newroot);
+
+ if (! is_oldroot && skip_chdir)
+ {
+ error (0, 0, _("option --skip-chdir only permitted if NEWROOT is old %s"),
+ quote ("/"));
+ usage (EXIT_CANCELED);
+ }
+
/* Only do chroot specific actions if actually changing root.
The main difference here is that we don't change working dir. */
- if (! is_root (argv[optind]))
+ if (! is_oldroot)
{
/* We have to look up users and groups twice.
- First, outside the chroot to load potentially necessary passwd/group
@@ -307,14 +329,14 @@ main (int argc, char **argv)
}
#endif
- if (chroot (argv[optind]) != 0)
+ if (chroot (newroot) != 0)
error (EXIT_CANCELED, errno, _("cannot change root directory to %s"),
- argv[optind]);
-
- if (chdir ("/"))
- error (EXIT_CANCELED, errno, _("cannot chdir to root directory"));
+ newroot);
}
+ if (! skip_chdir && chdir ("/"))
+ error (EXIT_CANCELED, errno, _("cannot chdir to root directory"));
+
if (argc == optind + 1)
{
/* No command. Run an interactive shell. */
Index: tests/cp/preserve-gid.sh
===================================================================
--- tests/cp/preserve-gid.sh.orig
+++ tests/cp/preserve-gid.sh
@@ -117,7 +117,8 @@ t1() {
u=$1; shift
g=$1; shift
t0 "$f" "$u" "$g" \
- chroot --user=+$nameless_uid:+$nameless_gid1 \
+ chroot --skip-chdir \
+ --user=+$nameless_uid:+$nameless_gid1 \
--groups="+$nameless_gid1,+$nameless_gid2" \
/ env PATH="$tmp_path" "$@"
}
Index: tests/cp/special-bits.sh
===================================================================
--- tests/cp/special-bits.sh.orig
+++ tests/cp/special-bits.sh
@@ -42,7 +42,8 @@ set _ $(ls -l b); shift; p1=$1
set _ $(ls -l b2); shift; p2=$1
test $p1 = $p2 || fail=1
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" cp -p c c2 || fail=1
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" cp -p c c2 \
+ || fail=1
set _ $(ls -l c); shift; p1=$1
set _ $(ls -l c2); shift; p2=$1
test $p1 = $p2 && fail=1
Index: tests/id/setgid.sh
===================================================================
--- tests/id/setgid.sh.orig
+++ tests/id/setgid.sh
@@ -27,14 +27,14 @@ echo $gp1 > exp || framework_failure_
# With coreutils-8.16 and earlier, id -G would print both:
# $gp1 $NON_ROOT_GID
-chroot --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / env PATH="$PATH" \
- id -G > out || fail=1
+chroot --skip-chdir --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / \
+ env PATH="$PATH" id -G > out || fail=1
compare exp out || fail=1
# With coreutils-8.22 and earlier, id would erroneously print
# groups=$NON_ROOT_GID
-chroot --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / env PATH="$PATH" \
- id > out || fail=1
+chroot --skip-chdir --user=$NON_ROOT_USERNAME:+$gp1 --groups='' / \
+ env PATH="$PATH" id > out || fail=1
grep -F "groups=$gp1" out || { cat out; fail=1; }
Exit $fail
Index: tests/misc/chroot-fail.sh
===================================================================
--- tests/misc/chroot-fail.sh.orig
+++ tests/misc/chroot-fail.sh
@@ -30,7 +30,7 @@ chroot --- / true # unknown option
test $? = 125 || fail=1
# Note chroot("/") succeeds for non-root users on some systems, but not all,
-# however we avoid the chroot() with "/" to have common behvavior.
+# however we avoid the chroot() with "/" to have common behavior.
chroot / sh -c 'exit 2' # exit status propagation
test $? = 2 || fail=1
chroot / . # invalid command
@@ -38,10 +38,25 @@ test $? = 126 || fail=1
chroot / no_such # no such command
test $? = 127 || fail=1
-# Ensure we don't chdir("/") when not changing root
-# to allow only changing user ids for a command.
-for dir in '/' '/.' '/../'; do
+# Ensure that --skip-chdir fails with a non-"/" argument.
+cat <<\EOF > exp || framework_failure_
+chroot: option --skip-chdir only permitted if NEWROOT is old '/'
+Try 'chroot --help' for more information.
+EOF
+chroot --skip-chdir . env pwd >out 2>err && fail=1
+compare /dev/null out || fail=1
+compare exp err || fail=1
+
+# Ensure we don't chroot("/") when NEWROOT is old "/".
+ln -s / isroot || framework_failure_
+for dir in '/' '/.' '/../' isroot; do
+ # Verify that chroot(1) succeeds and performs chdir("/")
+ # (chroot(1) of coreutils-8.23 failed to run the latter).
curdir=$(chroot "$dir" env pwd) || fail=1
+ test "$curdir" = '/' || fail=1
+
+ # Test the "--skip-chdir" option.
+ curdir=$(chroot --skip-chdir "$dir" env pwd) || fail=1
test "$curdir" = '/' && fail=1
done
Index: tests/misc/truncate-owned-by-other.sh
===================================================================
--- tests/misc/truncate-owned-by-other.sh.orig
+++ tests/misc/truncate-owned-by-other.sh
@@ -29,7 +29,7 @@ chmod g+w root-owned
# Ensure that the current directory is searchable by $NON_ROOT_USERNAME.
chmod g+x .
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
truncate -s0 root-owned || fail=1
Exit $fail
Index: tests/mv/sticky-to-xpart.sh
===================================================================
--- tests/mv/sticky-to-xpart.sh.orig
+++ tests/mv/sticky-to-xpart.sh
@@ -42,7 +42,8 @@ chmod go+x . || framework_failure_
# Ensure that $NON_ROOT_USERNAME can access the required version of mv.
version=$(
- chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" mv --version |
+ chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+ mv --version |
sed -n '1s/.* //p'
)
case $version in
@@ -50,7 +51,7 @@ case $version in
*) skip_ "cannot access just-built mv as user $NON_ROOT_USERNAME";;
esac
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
mv t/root-owned "$other_partition_tmpdir" 2> out-t && fail=1
# On some systems, we get 'Not owner'. Convert it.
Index: tests/rm/fail-2eperm.sh
===================================================================
--- tests/rm/fail-2eperm.sh.orig
+++ tests/rm/fail-2eperm.sh
@@ -32,14 +32,16 @@ touch a/b || framework_failure_
# Try to ensure that $NON_ROOT_USERNAME can access
# the required version of rm.
rm_version=$(
- chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" rm --version |
+ chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+ rm --version |
sed -n '1s/.* //p'
)
case $rm_version in
$PACKAGE_VERSION) ;;
*) skip_ "cannot access just-built rm as user $NON_ROOT_USERNAME";;
esac
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" rm -rf a 2> out-t && fail=1
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / \
+ env PATH="$PATH" rm -rf a 2> out-t && fail=1
# On some systems, we get 'Not owner'. Convert it.
# On other systems (HPUX), we get 'Permission denied'. Convert it, too.
Index: tests/rm/no-give-up.sh
===================================================================
--- tests/rm/no-give-up.sh.orig
+++ tests/rm/no-give-up.sh
@@ -30,7 +30,7 @@ chmod go=x . || framework_failure_
# This must fail, since '.' is not writable by $NON_ROOT_USERNAME.
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
rm -rf d 2>/dev/null && fail=1
# d must remain.
Index: tests/touch/now-owned-by-other.sh
===================================================================
--- tests/touch/now-owned-by-other.sh.orig
+++ tests/touch/now-owned-by-other.sh
@@ -28,7 +28,7 @@ chmod g+w root-owned
# Ensure that the current directory is searchable by $NON_ROOT_USERNAME.
chmod g+x .
-chroot --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
+chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
touch -d now root-owned || fail=1
Exit $fail

View File

@ -1,90 +0,0 @@
Upstream patch on top of 8.22:
http://lists.gnu.org/archive/html/coreutils/2014-01/msg00012.html
Stripped down to the relevant part: NEWS and THANKS.in chunks removed.
Original NEWS entry:
cp -a again sets the correct SELinux context for existing directories in
the destination. Previously it set the context of an existing directory
to that of its last copied descendent.
[bug introduced in coreutils-8.22]
Originally reported for Fedora by Michal Trunecka in rh#1045122:
https://bugzilla.redhat.com/show_bug.cgi?id=1045122
______________________________________________________________________
From f2f8b688b87b94ed3551f47f9a6422c873acf5d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Sun, 5 Jan 2014 15:00:55 +0000
Subject: [PATCH] copy: fix SELinux context preservation for existing
directories
* src/copy.c (copy_internal): Use the global process context
to set the context of existing directories before they're populated.
This is more consistent with the new directory case, and fixes
a bug for existing directories where we erroneously set the
context to the last copied descendent, rather than to that of
the source directory itself.
* tests/cp/cp-a-selinux.sh: Add a test for this case.
---
src/copy.c | 13 ++++++++++++-
tests/cp/cp-a-selinux.sh | 15 +++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
Index: src/copy.c
===================================================================
--- src/copy.c.orig
+++ src/copy.c
@@ -2408,6 +2408,17 @@ copy_internal (char const *src_name, cha
else
{
omitted_permissions = 0;
+
+ /* For directories, the process global context could be reset for
+ descendents, so use it to set the context for existing dirs here.
+ This will also give earlier indication of failure to set ctx. */
+ if (x->set_security_context || x->preserve_security_context)
+ if (! set_file_security_ctx (dst_name, x->preserve_security_context,
+ false, x))
+ {
+ if (x->require_preserve_context)
+ goto un_backup;
+ }
}
/* Decide whether to copy the contents of the directory. */
@@ -2598,7 +2609,7 @@ copy_internal (char const *src_name, cha
/* With -Z or --preserve=context, set the context for existing files.
Note this is done already for copy_reg() for reasons described therein. */
- if (!new_dst && !x->copy_as_regular
+ if (!new_dst && !x->copy_as_regular && !S_ISDIR (src_mode)
&& (x->set_security_context || x->preserve_security_context))
{
if (! set_file_security_ctx (dst_name, x->preserve_security_context,
Index: tests/cp/cp-a-selinux.sh
===================================================================
--- tests/cp/cp-a-selinux.sh.orig
+++ tests/cp/cp-a-selinux.sh
@@ -41,6 +41,21 @@ test -s err && fail=1 #there must be n
ls -Z e | grep $ctx || fail=1
ls -Z f | grep $ctx || fail=1
+# Check handling of existing dirs which requires specific handling
+# due to recursion, and was handled incorrectly in coreutils-8.22
+mkdir -p backup/existing_dir/ || framework_failure_
+ls -Zd backup/existing_dir | grep $ctx && framework_failure_
+touch backup/existing_dir/file || framework_failure_
+chcon $ctx backup/existing_dir/file || framework_failure_
+# Set the dir context to ensure it is reset
+mkdir -p --context="$ctx" restore/existing_dir || framework_failure_
+# Set the permissions of the source to show they're reset too
+chmod o+rw restore/existing_dir
+# Copy and ensure existing directories updated
+cp -a backup/. restore/
+ls -Zd restore/existing_dir | grep $ctx &&
+ { ls -lZd restore/existing_dir; fail=1; }
+
# Check restorecon (-Z) functionality for file and directory
get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
# Also make a dir with our known context

View File

@ -1,154 +0,0 @@
Port upstream fix for date(1), to be removed with v8.23:
date could crash or go into an infinite loop when parsing a malformed TZ="".
[bug introduced with the --date='TZ="" ..' parsing feature in coreutils-5.3.0]
This patch consists of 2 upstream commits:
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=a10acfb1d2
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=a4faa6a0a3
While the former commit in gnulib actually fixes the issue (and adds a test
there), the latter commit in upstream coreutils pulls in that change from
gnulib and adds a test for the previously crashing date(1) command.
-----------------------------------------------
commit a10acfb1d2118f9a180181d3fed5399dbbe1df3c
Author: Pádraig Brady <P@draigBrady.com>
Date: Tue Feb 25 10:58:48 2014 +0000
parse-datetime: fix crash or infloop in TZ="" parsing
This was reported in http://bugs.gnu.org/16872
from the coreutils command: date -d 'TZ="""'
The infinite loop for this case was present since the
initial TZ="" parsing support in commit de95bdc2 29-10-2004.
This was changed to a crash or heap corruption depending
on the platform with commit 2e3e4195 18-01-2010.
* lib/parse-datetime.y (parse_datetime): Break out of the
TZ="" parsing loop once the second significant " is found.
Also skip over any subsequent whitespace to be consistent
with the non TZ= case.
* tests/test-parse-datetime.c: Add test cases for TZ="" parsing.
Omit the NEWS entry from the original patch.
-----------------------------------------------
commit a4faa6a0a3ae93c01d036d830ae7a21b74913baf
Author: Pádraig Brady <P@draigBrady.com>
Date: Thu Feb 27 23:43:34 2014 +0000
date: fix crash or infinite loop when parsing a malformed TZ=""
* gnulib: Update to incorporate the fix.
This is the only change in this gnulib update.
* tests/misc/date.pl: Add a test for this case.
Fixes http://bugs.gnu.org/16872
Omit the NEWS entry from the original patch.
---
gnulib-tests/test-parse-datetime.c | 16 ++++++++++++++++
lib/parse-datetime.c | 7 +++++--
lib/parse-datetime.y | 7 +++++--
tests/misc/date.pl | 7 +++++++
4 files changed, 33 insertions(+), 4 deletions(-)
Index: lib/parse-datetime.y
===================================================================
--- lib/parse-datetime.y.orig
+++ lib/parse-datetime.y
@@ -1303,8 +1303,6 @@ parse_datetime (struct timespec *result,
char tz1buf[TZBUFSIZE];
bool large_tz = TZBUFSIZE < tzsize;
bool setenv_ok;
- /* Free tz0, in case this is the 2nd or subsequent time through. */
- free (tz0);
tz0 = get_tz (tz0buf);
z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
for (s = tzbase; *s != '"'; s++)
@@ -1316,7 +1314,12 @@ parse_datetime (struct timespec *result,
if (!setenv_ok)
goto fail;
tz_was_altered = true;
+
p = s + 1;
+ while (c = *p, c_isspace (c))
+ p++;
+
+ break;
}
}
Index: lib/parse-datetime.c
===================================================================
--- lib/parse-datetime.c.orig
+++ lib/parse-datetime.c
@@ -3207,8 +3207,6 @@ parse_datetime (struct timespec *result,
char tz1buf[TZBUFSIZE];
bool large_tz = TZBUFSIZE < tzsize;
bool setenv_ok;
- /* Free tz0, in case this is the 2nd or subsequent time through. */
- free (tz0);
tz0 = get_tz (tz0buf);
z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
for (s = tzbase; *s != '"'; s++)
@@ -3220,7 +3218,12 @@ parse_datetime (struct timespec *result,
if (!setenv_ok)
goto fail;
tz_was_altered = true;
+
p = s + 1;
+ while (c = *p, c_isspace (c))
+ p++;
+
+ break;
}
}
Index: tests/misc/date.pl
===================================================================
--- tests/misc/date.pl.orig
+++ tests/misc/date.pl
@@ -287,6 +287,13 @@ my @Tests =
{ERR => "date: invalid date '\\260'\n"},
{EXIT => 1},
],
+
+ # From coreutils-5.3.0 to 8.22 inclusive
+ # this would either infinite loop or crash
+ ['invalid-TZ-crash', "-d 'TZ=\"\"\"'",
+ {ERR => "date: invalid date 'TZ=\"\"\"'\n"},
+ {EXIT => 1},
+ ],
);
# Repeat the cross-dst test, using Jan 1, 2005 and every interval from 1..364.
Index: gnulib-tests/test-parse-datetime.c
===================================================================
--- gnulib-tests/test-parse-datetime.c.orig
+++ gnulib-tests/test-parse-datetime.c
@@ -419,5 +419,21 @@ main (int argc _GL_UNUSED, char **argv)
starting with a high-bit-set byte would be treated like "0". */
ASSERT ( ! parse_datetime (&result, "\xb0", &now));
+ /* Exercise TZ="" parsing code. */
+ /* These two would infloop or segfault before Feb 2014. */
+ ASSERT ( ! parse_datetime (&result, "TZ=\"\"\"", &now));
+ ASSERT ( ! parse_datetime (&result, "TZ=\"\" \"", &now));
+ /* Exercise invalid patterns. */
+ ASSERT ( ! parse_datetime (&result, "TZ=\"", &now));
+ ASSERT ( ! parse_datetime (&result, "TZ=\"\\\"", &now));
+ ASSERT ( ! parse_datetime (&result, "TZ=\"\\n", &now));
+ ASSERT ( ! parse_datetime (&result, "TZ=\"\\n\"", &now));
+ /* Exercise valid patterns. */
+ ASSERT ( parse_datetime (&result, "TZ=\"\"", &now));
+ ASSERT ( parse_datetime (&result, "TZ=\"\" ", &now));
+ ASSERT ( parse_datetime (&result, " TZ=\"\"", &now));
+ ASSERT ( parse_datetime (&result, "TZ=\"\\\\\"", &now));
+ ASSERT ( parse_datetime (&result, "TZ=\"\\\"\"", &now));
+
return 0;
}

View File

@ -0,0 +1,17 @@
---
man/local.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: man/local.mk
===================================================================
--- man/local.mk.orig
+++ man/local.mk
@@ -41,7 +41,7 @@ distclean-local:
test x$(srcdir) = x$(builddir) || rm -f $(ALL_MANS)
# Dependencies common to all man pages. Updated below.
-mandeps =
+mandeps = $(PROGRAMS)
# Depend on this to get version number changes.
mandeps += .version

View File

@ -1,75 +0,0 @@
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

View File

@ -4,8 +4,8 @@
Index: gnulib-tests/test-getaddrinfo.c
===================================================================
--- gnulib-tests/test-getaddrinfo.c.orig 2013-12-04 15:53:33.000000000 +0100
+++ gnulib-tests/test-getaddrinfo.c 2014-02-20 17:59:57.474430854 +0100
--- gnulib-tests/test-getaddrinfo.c.orig
+++ gnulib-tests/test-getaddrinfo.c
@@ -86,11 +86,7 @@ simple (char const *host, char const *se
the test merely because someone is down the country on their
in-law's farm. */

View File

@ -1,46 +0,0 @@
---
gnulib-tests/test-isnanl.h | 9 +++++++++
gnulib-tests/test-signbit.c | 10 ++++++++++
2 files changed, 19 insertions(+)
Index: gnulib-tests/test-isnanl.h
===================================================================
--- gnulib-tests/test-isnanl.h.orig
+++ gnulib-tests/test-isnanl.h
@@ -51,6 +51,15 @@ main ()
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
+#if defined __powerpc__ && LDBL_MANT_DIG == 106
+ /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are
+ represented as the corresponding 64-bit IEEE values in the first double;
+ the second is ignored. Manipulate only the first double. */
+ #undef NWORDS
+ #define NWORDS \
+ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+#endif
+
memory_long_double m;
m.value = NaNl ();
# if LDBL_EXPBIT0_BIT > 0
Index: gnulib-tests/test-signbit.c
===================================================================
--- gnulib-tests/test-signbit.c.orig
+++ gnulib-tests/test-signbit.c
@@ -151,6 +151,16 @@ test_signbitl ()
#define NWORDS \
((sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { long double value; unsigned int word[NWORDS]; } memory_long_double;
+
+#if defined __powerpc__ && LDBL_MANT_DIG == 106
+ /* This is PowerPC "double double", a pair of two doubles. Inf and Nan are
+ represented as the corresponding 64-bit IEEE values in the first double;
+ the second is ignored. Manipulate only the first double. */
+ #undef NWORDS
+ #define NWORDS \
+ ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
+#endif
+
memory_long_double m;
m.value = zerol / zerol;
# if LDBL_EXPBIT0_BIT > 0

View File

@ -154,7 +154,7 @@ Index: src/cut.c
+ /* Output characters that are at the given positions. */
+ character_mode,
+
/* Output the given delimeter-separated fields. */
/* Output the given delimiter-separated fields. */
field_mode
};
@ -167,12 +167,12 @@ Index: src/cut.c
+ if this program runs on multibyte locale. */
+static int force_singlebyte_mode;
+
/* If true do not output lines containing no delimeter characters.
/* If true do not output lines containing no delimiter characters.
Otherwise, all such lines are printed. This option is valid only
with field mode. */
@@ -126,6 +201,9 @@ static bool complement;
/* The delimeter character for field mode. */
/* The delimiter character for field mode. */
static unsigned char delim;
+#if HAVE_WCHAR_H
+static wchar_t wcdelim;
@ -282,7 +282,7 @@ Index: src/cut.c
/* Read from stream STREAM, printing to standard output any selected fields. */
static void
@@ -629,13 +786,201 @@ cut_fields (FILE *stream)
@@ -649,13 +806,201 @@ cut_fields (FILE *stream)
}
}
@ -487,7 +487,7 @@ Index: src/cut.c
}
/* Process file FILE to standard output.
@@ -687,6 +1032,7 @@ main (int argc, char **argv)
@@ -707,6 +1052,7 @@ main (int argc, char **argv)
bool ok;
bool delim_specified = false;
char *spec_list_string IF_LINT ( = NULL);
@ -495,7 +495,7 @@ Index: src/cut.c
initialize_main (&argc, &argv);
set_program_name (argv[0]);
@@ -709,7 +1055,6 @@ main (int argc, char **argv)
@@ -729,7 +1075,6 @@ main (int argc, char **argv)
switch (optc)
{
case 'b':
@ -503,7 +503,7 @@ Index: src/cut.c
/* Build the byte list. */
if (operating_mode != undefined_mode)
FATAL_ERROR (_("only one type of list may be specified"));
@@ -717,6 +1062,14 @@ main (int argc, char **argv)
@@ -737,6 +1082,14 @@ main (int argc, char **argv)
spec_list_string = optarg;
break;
@ -518,7 +518,7 @@ Index: src/cut.c
case 'f':
/* Build the field list. */
if (operating_mode != undefined_mode)
@@ -728,10 +1081,38 @@ main (int argc, char **argv)
@@ -748,10 +1101,38 @@ main (int argc, char **argv)
case 'd':
/* New delimiter. */
/* Interpret -d '' to mean 'use the NUL byte as the delimiter.' */
@ -561,7 +561,7 @@ Index: src/cut.c
break;
case OUTPUT_DELIMITER_OPTION:
@@ -744,6 +1125,7 @@ main (int argc, char **argv)
@@ -764,6 +1145,7 @@ main (int argc, char **argv)
break;
case 'n':
@ -569,7 +569,7 @@ Index: src/cut.c
break;
case 's':
@@ -783,15 +1165,34 @@ main (int argc, char **argv)
@@ -803,15 +1185,34 @@ main (int argc, char **argv)
}
if (!delim_specified)
@ -3352,7 +3352,7 @@ Index: src/sort.c
{
/* Note xmemcoll0 is a performance enhancement as
it will not unconditionally write '\0' after the
@@ -4113,6 +4738,7 @@ set_ordering (char const *s, struct keyf
@@ -4121,6 +4746,7 @@ set_ordering (char const *s, struct keyf
break;
case 'f':
key->translate = fold_toupper;
@ -3360,7 +3360,7 @@ Index: src/sort.c
break;
case 'g':
key->general_numeric = true;
@@ -4190,7 +4816,7 @@ main (int argc, char **argv)
@@ -4198,7 +4824,7 @@ main (int argc, char **argv)
initialize_exit_failure (SORT_FAILURE);
hard_LC_COLLATE = hard_locale (LC_COLLATE);
@ -3369,7 +3369,7 @@ Index: src/sort.c
hard_LC_TIME = hard_locale (LC_TIME);
#endif
@@ -4211,6 +4837,29 @@ main (int argc, char **argv)
@@ -4219,6 +4845,29 @@ main (int argc, char **argv)
thousands_sep = -1;
}
@ -3399,7 +3399,7 @@ Index: src/sort.c
have_read_stdin = false;
inittables ();
@@ -4485,13 +5134,34 @@ main (int argc, char **argv)
@@ -4493,13 +5142,34 @@ main (int argc, char **argv)
case 't':
{
@ -3438,7 +3438,7 @@ Index: src/sort.c
else
{
/* Provoke with 'sort -txx'. Complain about
@@ -4502,9 +5172,12 @@ main (int argc, char **argv)
@@ -4510,9 +5180,12 @@ main (int argc, char **argv)
quote (optarg));
}
}
@ -3766,7 +3766,7 @@ Index: src/uniq.c
static struct option const longopts[] =
{
{"count", no_argument, NULL, 'c'},
@@ -249,7 +276,7 @@ size_opt (char const *opt, char const *m
@@ -251,7 +278,7 @@ size_opt (char const *opt, char const *m
return a pointer to the beginning of the line's field to be compared. */
static char * _GL_ATTRIBUTE_PURE
@ -3775,7 +3775,7 @@ Index: src/uniq.c
{
size_t count;
char const *lp = line->buffer;
@@ -269,6 +296,83 @@ find_field (struct linebuffer const *lin
@@ -271,6 +298,83 @@ find_field (struct linebuffer const *lin
return line->buffer + i;
}
@ -3859,7 +3859,7 @@ Index: src/uniq.c
/* Return false if two strings OLD and NEW match, true if not.
OLD and NEW point not to the beginnings of the lines
but rather to the beginnings of the fields to compare.
@@ -277,6 +381,8 @@ find_field (struct linebuffer const *lin
@@ -279,6 +383,8 @@ find_field (struct linebuffer const *lin
static bool
different (char *old, char *new, size_t oldlen, size_t newlen)
{
@ -3868,7 +3868,7 @@ Index: src/uniq.c
if (check_chars < oldlen)
oldlen = check_chars;
if (check_chars < newlen)
@@ -284,15 +390,104 @@ different (char *old, char *new, size_t
@@ -286,15 +392,104 @@ different (char *old, char *new, size_t
if (ignore_case)
{
@ -3978,7 +3978,7 @@ Index: src/uniq.c
/* Output the line in linebuffer LINE to standard output
provided that the switches say it should be output.
MATCH is true if the line matches the previous line.
@@ -356,19 +551,38 @@ check_file (const char *infile, const ch
@@ -358,19 +553,38 @@ check_file (const char *infile, const ch
char *prevfield IF_LINT ( = NULL);
size_t prevlen IF_LINT ( = 0);
bool first_group_printed = false;
@ -4017,7 +4017,7 @@ Index: src/uniq.c
new_group = (prevline->length == 0
|| different (thisfield, prevfield, thislen, prevlen));
@@ -386,6 +600,10 @@ check_file (const char *infile, const ch
@@ -388,6 +602,10 @@ check_file (const char *infile, const ch
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@ -4028,7 +4028,7 @@ Index: src/uniq.c
first_group_printed = true;
}
}
@@ -398,17 +616,26 @@ check_file (const char *infile, const ch
@@ -400,17 +618,26 @@ check_file (const char *infile, const ch
size_t prevlen;
uintmax_t match_count = 0;
bool first_delimiter = true;
@ -4055,7 +4055,7 @@ Index: src/uniq.c
if (readlinebuffer_delim (thisline, stdin, delimiter) == 0)
{
if (ferror (stdin))
@@ -417,6 +644,14 @@ check_file (const char *infile, const ch
@@ -419,6 +646,14 @@ check_file (const char *infile, const ch
}
thisfield = find_field (thisline);
thislen = thisline->length - 1 - (thisfield - thisline->buffer);
@ -4070,7 +4070,7 @@ Index: src/uniq.c
match = !different (thisfield, prevfield, thislen, prevlen);
match_count += match;
@@ -449,6 +684,9 @@ check_file (const char *infile, const ch
@@ -451,6 +686,9 @@ check_file (const char *infile, const ch
SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
@ -4080,7 +4080,7 @@ Index: src/uniq.c
if (!match)
match_count = 0;
}
@@ -495,6 +733,19 @@ main (int argc, char **argv)
@@ -497,6 +735,19 @@ main (int argc, char **argv)
atexit (close_stdout);
@ -4104,7 +4104,7 @@ Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
@@ -324,6 +324,7 @@ all_tests = \
@@ -331,6 +331,7 @@ all_tests = \
tests/misc/sort-discrim.sh \
tests/misc/sort-files0-from.pl \
tests/misc/sort-float.sh \
@ -4130,7 +4130,7 @@ Index: tests/misc/cut.pl
my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n";
@@ -225,6 +227,7 @@ if ($mb_locale ne 'C')
@@ -227,6 +229,7 @@ if ($mb_locale ne 'C')
my @new_t = @$t;
my $test_name = shift @new_t;

View File

@ -1,51 +0,0 @@
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"))

View File

@ -1,53 +0,0 @@
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);
}

View File

@ -1,75 +0,0 @@
Port upstream commit, to be removed with v8.23:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=0093ac8d57
ln: with -sr, don't segfault for a TARGET of ''
ln -sr '' F no longer segfaults. Now works as expected.
[bug introduced with the --relative feature in coreutils-8.16]
The changes in NEWS and THANKS.in in the original patch have been omitted.
-----------------------------------------------
commit 0093ac8d57a0f1a16fd09d98f6a524dddb6053e7
Author: Jim Meyering <meyering@fb.com>
Date: Thu Mar 13 17:05:04 2014 -0700
ln: with -sr, don't segfault for a TARGET of ''
Prior to this change, "ln -sr '' F" would segfault, attempting
to read path2[1] in relpath.c's path_common_prefix function.
This problem arises whenever canonicalize_filename_mode returns
NULL.
* src/ln.c (convert_abs_rel): Call relpath only when
both canonicalize_filename_mode calls return non-NULL.
* tests/ln/relative.sh: Add a test to trigger this failure.
Reported by Erik Bernstein in 739752@bugs.debian.org.
Fixes http://bugs.gnu.org/17010.
---
src/ln.c | 16 ++++++++++------
tests/ln/relative.sh | 5 +++++
2 files changed, 15 insertions(+), 6 deletions(-)
Index: src/ln.c
===================================================================
--- src/ln.c.orig
+++ src/ln.c
@@ -139,13 +139,17 @@ convert_abs_rel (const char *from, const
char *realdest = canonicalize_filename_mode (targetdir, CAN_MISSING);
char *realfrom = canonicalize_filename_mode (from, CAN_MISSING);
- /* Write to a PATH_MAX buffer. */
- char *relative_from = xmalloc (PATH_MAX);
-
- if (!relpath (realfrom, realdest, relative_from, PATH_MAX))
+ char *relative_from = NULL;
+ if (realdest && realfrom)
{
- free (relative_from);
- relative_from = NULL;
+ /* Write to a PATH_MAX buffer. */
+ relative_from = xmalloc (PATH_MAX);
+
+ if (!relpath (realfrom, realdest, relative_from, PATH_MAX))
+ {
+ free (relative_from);
+ relative_from = NULL;
+ }
}
free (targetdir);
Index: tests/ln/relative.sh
===================================================================
--- tests/ln/relative.sh.orig
+++ tests/ln/relative.sh
@@ -45,4 +45,9 @@ mkdir web
ln -sr latest web/latest
test $(readlink web/latest) = '../release2' || fail=1
+# Expect this to fail with exit status 1, or to succeed quietly (freebsd).
+# Prior to coreutils-8.23, it would segfault.
+ln -sr '' F
+case $? in [01]) ;; *) fail=1;; esac
+
Exit $fail

View File

@ -1,55 +0,0 @@
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;
+ }
}
}

View File

@ -6,8 +6,8 @@
Index: gnulib-tests/test-isnanl.h
===================================================================
--- gnulib-tests/test-isnanl.h.orig 2013-12-04 15:53:33.000000000 +0100
+++ gnulib-tests/test-isnanl.h 2014-02-20 18:05:09.900982392 +0100
--- gnulib-tests/test-isnanl.h.orig
+++ gnulib-tests/test-isnanl.h
@@ -47,7 +47,7 @@ main ()
/* Quiet NaN. */
ASSERT (isnanl (NaNl ()));
@ -17,7 +17,7 @@ Index: gnulib-tests/test-isnanl.h
/* A bit pattern that is different from a Quiet NaN. With a bit of luck,
it's a Signalling NaN. */
{
@@ -89,6 +89,7 @@ main ()
@@ -98,6 +98,7 @@ main ()
{ LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) };
ASSERT (isnanl (x.value));
}
@ -25,7 +25,7 @@ Index: gnulib-tests/test-isnanl.h
/* The isnanl function should recognize Pseudo-NaNs, Pseudo-Infinities,
Pseudo-Zeroes, Unnormalized Numbers, and Pseudo-Denormals, as defined in
Intel IA-64 Architecture Software Developer's Manual, Volume 1:
@@ -122,6 +123,7 @@ main ()
@@ -131,6 +132,7 @@ main ()
ASSERT (isnanl (x.value));
}
#endif
@ -35,20 +35,20 @@ Index: gnulib-tests/test-isnanl.h
}
Index: tests/misc/help-version.sh
===================================================================
--- tests/misc/help-version.sh.orig 2013-12-04 15:48:30.000000000 +0100
+++ tests/misc/help-version.sh 2014-02-20 18:05:09.901982368 +0100
@@ -245,6 +245,7 @@ parted_setup () { args="-s $tmp_in mklab
--- tests/misc/help-version.sh.orig
+++ tests/misc/help-version.sh
@@ -240,6 +240,7 @@ parted_setup () { args="-s $tmp_in mklab
for i in $built_programs; do
# Skip these.
case $i in chroot|stty|tty|false|chcon|runcon) continue;; esac
case $i in chroot|stty|tty|false|chcon|runcon|coreutils) continue;; esac
+ case $i in df) continue;; esac
rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out $bigZ_in $zin $zin2
echo z |gzip > $zin
Index: tests/other-fs-tmpdir
===================================================================
--- tests/other-fs-tmpdir.orig 2014-02-20 18:05:09.901982368 +0100
+++ tests/other-fs-tmpdir 2014-02-20 18:06:52.108548168 +0100
--- tests/other-fs-tmpdir.orig
+++ tests/other-fs-tmpdir
@@ -43,6 +43,9 @@ for d in $CANDIDATE_TMP_DIRS; do
done

View File

@ -16,9 +16,9 @@ Signed-off-by: Jie Liu <jeff....@oracle.com>
Index: src/copy.c
===================================================================
--- src/copy.c.orig 2014-02-20 17:50:19.791236017 +0100
+++ src/copy.c 2014-02-20 17:54:06.068824055 +0100
@@ -221,6 +221,46 @@ sparse_copy (int src_fd, int dest_fd, ch
--- src/copy.c.orig
+++ src/copy.c
@@ -229,6 +229,46 @@ sparse_copy (int src_fd, int dest_fd, ch
return true;
}
@ -65,7 +65,7 @@ Index: src/copy.c
/* Perform the O(1) btrfs clone operation, if possible.
Upon success, return 0. Otherwise, return -1 and set errno. */
static inline int
@@ -930,6 +970,45 @@ copy_reg (char const *src_name, char con
@@ -938,6 +978,45 @@ copy_reg (char const *src_name, char con
goto close_src_desc;
}
@ -111,7 +111,7 @@ Index: src/copy.c
/* The semantics of the following open calls are mandated
by the specs for both cp and mv. */
if (! *new_dst)
@@ -1075,17 +1154,20 @@ copy_reg (char const *src_name, char con
@@ -1083,17 +1162,20 @@ copy_reg (char const *src_name, char con
/* --attributes-only overrides --reflink. */
if (data_copy_required && x->reflink_mode)
{

View File

@ -1,258 +0,0 @@
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()).

View File

@ -6,15 +6,15 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -66,7 +66,6 @@
@@ -69,7 +69,6 @@
* groups: (coreutils)groups invocation. Print group names a user is in.
* head: (coreutils)head invocation. Output the first part of files.
* hostid: (coreutils)hostid invocation. Print numeric host identifier.
-* hostname: (coreutils)hostname invocation. Print or set system name.
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy and change attributes.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
@@ -198,7 +197,7 @@ Free Documentation License''.
@@ -201,7 +200,7 @@ Free Documentation License''.
* File name manipulation:: dirname basename pathchk mktemp realpath
* Working context:: pwd stty printenv tty
* User information:: id logname whoami groups users who
@ -23,7 +23,7 @@ Index: doc/coreutils.texi
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
* Process control:: kill
@@ -417,7 +416,6 @@ System context
@@ -421,7 +420,6 @@ System context
* date invocation:: Print or set system date and time
* nproc invocation:: Print the number of processors
* uname invocation:: Print system information
@ -31,7 +31,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier
* uptime invocation:: Print system uptime and load
@@ -14852,7 +14850,6 @@ information.
@@ -14922,7 +14920,6 @@ information.
* arch invocation:: Print machine hardware name.
* nproc invocation:: Print the number of processors.
* uname invocation:: Print system information.
@ -39,7 +39,7 @@ Index: doc/coreutils.texi
* hostid invocation:: Print numeric host identifier.
* uptime invocation:: Print system uptime and load.
@end menu
@@ -15674,15 +15671,6 @@ easily available, as is the case with Li
@@ -15744,15 +15741,6 @@ easily available, as is the case with Li
Print the machine hardware name (sometimes called the hardware class
or hardware type).
@ -55,7 +55,7 @@ Index: doc/coreutils.texi
@item -p
@itemx --processor
@opindex -p
@@ -15736,30 +15724,6 @@ Print the kernel version.
@@ -15806,30 +15794,6 @@ Print the kernel version.
@exitstatus

View File

@ -6,15 +6,15 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -69,7 +69,6 @@
@@ -72,7 +72,6 @@
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy and change attributes.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
-* kill: (coreutils)kill invocation. Send a signal to processes.
* link: (coreutils)link invocation. Make hard links between files.
* ln: (coreutils)ln invocation. Make links between files.
* logname: (coreutils)logname invocation. Print current login name.
@@ -200,7 +199,6 @@ Free Documentation License''.
@@ -203,7 +202,6 @@ Free Documentation License''.
* System context:: date arch nproc uname hostid uptime
* SELinux context:: chcon runcon
* Modified command invocation:: chroot env nice nohup stdbuf timeout
@ -22,7 +22,7 @@ Index: doc/coreutils.texi
* Delaying:: sleep
* Numeric operations:: factor seq
* File permissions:: Access modes
@@ -444,10 +442,6 @@ Modified command invocation
@@ -448,10 +446,6 @@ Modified command invocation
* stdbuf invocation:: Run a command with modified I/O buffering
* timeout invocation:: Run a command with a time limit
@ -33,7 +33,7 @@ Index: doc/coreutils.texi
Delaying
* sleep invocation:: Delay for a specified time
@@ -16606,90 +16600,6 @@ the exit status of @var{command} otherwi
@@ -16688,90 +16682,6 @@ the exit status of @var{command} otherwi
@end display

View File

@ -1,200 +0,0 @@
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 \

View File

@ -1,85 +0,0 @@
Port upstream fix for shuf, to be removed with v8.23:
shuf --repeat no longer dumps core if the input is empty.
[bug introduced with the --repeat feature in coreutils-8.22]
This patch squashes these 2 upstream commits:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=9f60f37a28
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=5475e6083f
While the former implements the actual fix for the problem,
the latter only changes the new error diagnostic. The change in the
NEWS entry in the latter patch is not visible in the following patch
because that hunk is omitted; however, that corrected NEWS entry is
above.
-----------------------------------------------
commit 9f60f37a28c37acb66aa38003ccaa07f13abbd9d
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun Feb 23 15:34:48 2014 -0800
shuf: with -r, don't dump core if the input is empty
Problem reported by valiant xiao in <http://bugs.gnu.org/16855>.
* src/shuf.c (main): With -r, report an error if the input is empty.
* tests/misc/shuf.sh: Test for the bug.
-----------------------------------------------
commit 5475e6083f46a2f9f7ccf4173f391bf518421523
Author: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed Feb 26 08:36:50 2014 +0100
shuf: convert error diagnostic to lowercase
* src/shuf.c (main): s/No/no/, introduced by commit v8.22-25-g9f60f37.
Prompted by the syntax-check rule sc_error_message_uppercase
---
src/shuf.c | 15 +++++++++++----
tests/misc/shuf.sh | 4 ++++
2 files changed, 15 insertions(+), 4 deletions(-)
Index: src/shuf.c
===================================================================
--- src/shuf.c.orig
+++ src/shuf.c
@@ -576,11 +576,18 @@ main (int argc, char **argv)
/* Generate output according to requested method */
if (repeat)
{
- if (input_range)
- i = write_random_numbers (randint_source, head_lines,
- lo_input, hi_input, eolbyte);
+ if (head_lines == 0)
+ i = 0;
else
- i = write_random_lines (randint_source, head_lines, line, n_lines);
+ {
+ if (n_lines == 0)
+ error (EXIT_FAILURE, 0, _("no lines to repeat"));
+ if (input_range)
+ i = write_random_numbers (randint_source, head_lines,
+ lo_input, hi_input, eolbyte);
+ else
+ i = write_random_lines (randint_source, head_lines, line, n_lines);
+ }
}
else
{
Index: tests/misc/shuf.sh
===================================================================
--- tests/misc/shuf.sh.orig
+++ tests/misc/shuf.sh
@@ -43,6 +43,10 @@ compare in out1 || { fail=1; echo "not a
t=$(shuf -e a b c d e | sort | fmt)
test "$t" = 'a b c d e' || { fail=1; echo "not a permutation" 1>&2; }
+# coreutils-8.22 dumps core.
+shuf -er
+test $? -eq 1 || fail=1
+
# Before coreutils-6.3, this would infloop.
# "seq 1860" produces 8193 (8K + 1) bytes of output.
seq 1860 | shuf > /dev/null || fail=1

View File

@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -2303,9 +2303,10 @@ EXTRA_DIST += test-time.c
@@ -2206,9 +2206,10 @@ EXTRA_DIST += test-time.c
## begin gnulib module tls-tests

View File

@ -1,71 +0,0 @@
tests: avoid test framework failure if the file system lacks ACL support
Prompted by a test framework failure of tests/mkdir/p-acl.sh on VMs
where filesystem are mounted without ACL support.
I pushed the following patch upstream which will go into 8.23 some day.
_______________________________________________
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=5d7591d0
commit 5d7591d0edf0dd31c2daa195ee766c1383b89f4c
Author: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Fri Jan 10 16:48:25 2014 +0100
tests: improve test for a working setfacl
Prompted by a test framework failure of tests/mkdir/p-acl.sh on armv7l:
The previous test for a working setfacl was not sufficient in some
circumstances.
* init.cfg (require_setfacl_): Call setfacl twice with conflictive
ACL specs, and use ACL specs which can't be mapped into regular file
permission bits. Document the reasons.
---
init.cfg | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
Index: init.cfg
===================================================================
--- init.cfg.orig 2014-02-24 15:19:12.185467061 +0100
+++ init.cfg 2014-02-24 15:20:46.802273660 +0100
@@ -192,10 +192,38 @@ require_valgrind_()
skip_ "requires a working valgrind"
}
+# Skip the current test if setfacl doesn't work on the current file system,
+# which could happen if not installed, or if ACLs are not supported by the
+# kernel or the file system, or are turned off via mount options.
+#
+# Work around the following two issues:
+#
+# 1) setfacl maps ACLs into file permission bits if on "noacl" file systems.
+#
+# On file systems which do not support ACLs (e.g. ext4 mounted with -o noacl),
+# setfacl operates on the regular file permission bits, and only fails if the
+# given ACL spec does not fit into there. Thus, to test if ACLs really work
+# on the current file system, pass an ACL spec which can't be mapped that way.
+# "Default" ACLs (-d) seem to fulfill this requirement.
+#
+# 2) setfacl only invokes the underlying system call if the ACL would change.
+#
+# If the given ACL spec would not change the ACLs on the file, then setfacl
+# does not invoke the underlying system call - setxattr(). Therefore, to test
+# if setting ACLs really works on the current file system, call setfacl twice
+# with conflictive ACL specs.
require_setfacl_()
{
- setfacl -m user::rwx . \
- || skip_ "setfacl does not work on the current file system"
+ local d='acltestdir_'
+ mkdir $d || framework_failure_
+ local f=0
+
+ setfacl -d -m user::r-x $d \
+ && setfacl -d -m user::rwx $d \
+ || f=1
+ rm -rf $d || framework_failure_
+ test $f = 0 \
+ || skip_ "The current file system does not support ACLs"
}
# Require a controlling input 'terminal'.

View File

@ -1,36 +0,0 @@
From 84e67a5bd239179e2faded424861dce5718fa12c Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Tue, 7 Jan 2014 19:18:25 +0100
Subject: [PATCH] tests: avoid FP failure when cp fails for /proc/cpuinfo
On aarch64, cp fails to copy /proc/cpuinfo because the inode number
seems to change between the initial stat() call and copying the file:
$ cp /proc/cpuinfo exp
cp: skipping file '/proc/cpuinfo', as it was \
replaced while being copied
* tests/cp/proc-zero-len.sh: When cp fails, check on the above
error message to skip the test.
---
tests/cp/proc-zero-len.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: tests/cp/proc-zero-len.sh
===================================================================
--- tests/cp/proc-zero-len.sh.orig
+++ tests/cp/proc-zero-len.sh
@@ -27,7 +27,12 @@ test -r $f || f=empty
cat $f > out || fail=1
# With coreutils-6.9, this would create a zero-length "exp" file.
-cp $f exp || fail=1
+# Skip this test on architectures like aarch64 where the inode
+# number of the file changed during the cp run.
+cp $f exp 2>err \
+ || { fail=1;
+ grep 'replaced while being copied' \
+ && skip_ "File $f is being replaced while being copied"; }
# Don't simply compare contents; they might differ,
# e.g., if CPU freq changes between cat and cp invocations.

View File

@ -16,7 +16,7 @@ Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
@@ -649,14 +649,9 @@ all_tests = \
@@ -661,14 +661,9 @@ all_tests = \
# See tests/factor/create-test.sh.
tf = tests/factor
factor_tests = \

View File

@ -1,3 +1,215 @@
-------------------------------------------------------------------
Fri Aug 1 15:54:41 UTC 2014 - mail@bernhard-voelker.de
- Add patches for upstream glitches:
- coreutils-fix-man-deps.patch
- coreutils-chroot-perform-chdir-unless-skip-chdir.patch
- Refresh patches:
- coreutils-build-timeout-as-pie.patch
- coreutils-getaddrinfo.patch
- coreutils-i18n.patch
- coreutils-misc.patch
- coreutils-ocfs2_reflinks.patch
- coreutils-remove_hostname_documentation.patch
- coreutils-remove_kill_documentation.patch
- coreutils-skip-gnulib-test-tls.patch
- coreutils-tests-shorten-extreme-factor-tests.patch
- Remove now-upstream patches:
- coreutils-copy-fix-selinux-existing-dirs.patch
- coreutils-gnulib-tests-ppc64le.patch
- coreutils-tests-avoid-FP-cp-cpuinfo.patch
- coreutils-test-avoid-FP-when-no-ACL-support.patch
- coreutils-ln-avoid-segfault-for-empty-target.patch
- coreutils-date-avoid-crash-in-TZ-parsing.patch
- coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
- 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
- Update to 8.23 (2014-07-18) [stable]
** Bug fixes
chmod -Rc no longer issues erroneous warnings for files with special bits set.
[bug introduced in coreutils-6.0]
cp -a, mv, and install --preserve-context, once again set the correct SELinux
context for existing directories in the destination. Previously they set
the context of an existing directory to that of its last copied descendent.
[bug introduced in coreutils-8.22]
cp -a, mv, and install --preserve-context, no longer seg fault when running
with SELinux enabled, when copying from file systems that return an error
when reading the SELinux context for a file.
[bug introduced in coreutils-8.22]
cp -a and mv now preserve xattrs of symlinks copied across file systems.
[bug introduced with extended attribute preservation feature in coreutils-7.1]
date could crash or go into an infinite loop when parsing a malformed TZ="".
[bug introduced with the --date='TZ="" ..' parsing feature in coreutils-5.3.0]
dd's ASCII and EBCDIC conversions were incompatible with common practice and
with POSIX, and have been corrected as follows. First, conv=ascii now
implies conv=unblock, and conv=ebcdic and conv=ibm now imply conv=block.
Second, the translation tables for dd conv=ascii and conv=ebcdic have been
corrected as shown in the following table, where A is the ASCII value, W is
the old, wrong EBCDIC value, and E is the new, corrected EBCDIC value; all
values are in octal.
A W E
041 117 132
133 112 255
135 132 275
136 137 232
174 152 117
176 241 137
313 232 152
325 255 112
345 275 241
[These dd bugs were present in "the beginning".]
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".]
df now outputs all appropriate entries in the presence of bind mounts.
On some systems, entries would have been incorrectly elided due to
them being considered "dummy" mounts.
[bug introduced in coreutils-8.22]
du now silently ignores directory cycles introduced with bind mounts.
Previously it would issue a warning and exit with a failure status.
[bug introduced in coreutils-8.1]
head --bytes=-N and --lines=-N now handles devices more
consistently, not ignoring data from virtual devices like /dev/zero,
or on BSD systems data from tty devices.
[bug introduced in coreutils-5.0.1]
head --bytes=-N - no longer fails with a bogus diagnostic when stdin's
seek pointer is not at the beginning.
[bug introduced with the --bytes=-N feature in coreutils-5.0.1]
head --lines=-0, when the input does not contain a trailing '\n',
now copies all input to stdout. Previously nothing was output in this case.
[bug introduced with the --lines=-N feature in coreutils-5.0.1]
id, when invoked with no user name argument, now prints the correct group ID.
Previously, in the default output format, it would print the default group ID
in the password database, which may be neither real nor effective. For e.g.,
when run set-GID, or when the database changes outside the current session.
[bug introduced in coreutils-8.1]
ln -sf now replaces symbolic links whose targets can't exist. Previously
it would display an error, requiring --no-dereference to avoid the issue.
[bug introduced in coreutils-5.3.0]
ln -sr '' F no longer segfaults. Now works as expected.
[bug introduced with the --relative feature in coreutils-8.16]
numfmt now handles blanks correctly in all unibyte locales. Previously
in locales where character 0xA0 is a blank, numfmt would mishandle it.
[bug introduced when numfmt was added in coreutils-8.21]
ptx --format long option parsing no longer falls through into the --help case.
[bug introduced in TEXTUTILS-1_22i]
ptx now consistently trims whitespace when processing multiple files.
[This bug was present in "the beginning".]
seq again generates correct output with start or end values = -0.
[bug introduced in coreutils-8.20.]
shuf --repeat no longer dumps core if the input is empty.
[bug introduced with the --repeat feature in coreutils-8.22]
sort when using multiple threads now avoids undefined behavior with mutex
destruction, which could cause deadlocks on some implementations.
[bug introduced in coreutils-8.6]
tail -f now uses polling mode for VXFS to cater for its clustered mode.
[bug introduced with inotify support added in coreutils-7.5]
** New features
od accepts a new option: --endian=TYPE to handle inputs with different byte
orders, or to provide consistent output on systems with disparate endianness.
configure accepts the new option --enable-single-binary to build all the
selected programs in a single binary called "coreutils". The selected
programs can still be called directly using symlinks to "coreutils" or
shebangs with the option --coreutils-prog= passed to this program. The
install behavior is determined by the option --enable-single-binary=symlinks
or --enable-single-binary=shebangs (the default). With the symlinks option,
you can't make a second symlink to any program because that will change the
name of the called program, which is used by coreutils to determine the
desired program. The shebangs option doesn't suffer from this problem, but
the /proc/$pid/cmdline file might not be updated on all the platforms. The
functionality of each program is not affected but this single binary will
depend on all the required dynamic libraries even to run simple programs.
If you desire to build some tools outside the single binary file, you can
pass the option --enable-single-binary-exceptions=PROG_LIST with the comma
separated list of programs you want to build separately. This flag
considerably reduces the overall size of the installed binaries which makes
it suitable for embedded system.
** Changes in behavior
chroot with an argument of "/" no longer implicitly changes the current
directory to "/", allowing changing only user credentials for a command.
chroot --userspec will now unset supplemental groups associated with root,
and instead use the supplemental groups of the specified user.
cut -d$'\n' again outputs lines identified in the --fields list, having
not done so in v8.21 and v8.22. Note using this non portable functionality
will result in the delayed output of lines.
ls with none of LS_COLORS or COLORTERM environment variables set,
will now honor an empty or unknown TERM environment variable,
and not output colors even with --colors=always.
** Improvements
chroot has better --userspec and --group look-ups, with numeric IDs never
causing name look-up errors. Also look-ups are first done outside the chroot,
in case the look-up within the chroot fails due to library conflicts etc.
install now allows the combination of the -D and -t options.
numfmt supports zero padding of numbers using the standard printf
syntax of a leading zero, for example --format="%010f".
Also throughput was improved by up to 800% by avoiding redundant processing.
shred now supports multiple passes on GNU/Linux tape devices by rewinding
the tape before each pass, avoids redundant writes to empty files,
uses direct I/O for all passes where possible, and attempts to clear
inode storage used for small files on some file systems.
split avoids unnecessary input buffering, immediately writing input to output
which is significant with --filter or when writing to fifos or stdout etc.
stat and tail work better with HFS+, HFSX, LogFS and ConfigFS. stat -f
--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.
-------------------------------------------------------------------
Fri Jul 25 23:48:47 CEST 2014 - pth@suse.de

View File

@ -21,7 +21,7 @@ Summary: GNU Core Utilities
License: GPL-3.0+
Group: System/Base
Url: http://www.gnu.org/software/coreutils/
Version: 8.22
Version: 8.23
Release: 0
#################################################################
@ -97,10 +97,6 @@ Patch16: coreutils-invalid-ids.patch
# OBS / RPMLINT require /usr/bin/timeout to be built with the -fpie option.
Patch100: coreutils-build-timeout-as-pie.patch
# Upstream patch to 8.22: cp -a: set the correct SELinux context
# on already existing destination directories.
Patch110: coreutils-copy-fix-selinux-existing-dirs.patch
# At least a bit of reflink support
Patch111: coreutils-ocfs2_reflinks.patch
@ -110,9 +106,6 @@ Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Fix imported gnulib long double math tests for little-endian PowerPC
Patch202: coreutils-gnulib-tests-ppc64le.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
# a glibc issue in mkstemp.
Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
@ -121,43 +114,16 @@ Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
Patch301: coreutils-skip-gnulib-test-tls.patch
%endif
# tests: avoid FP failure when cp fails for /proc/cpuinfo
# which happens e.g. on aarch64.
Patch302: coreutils-tests-avoid-FP-cp-cpuinfo.patch
# tests: shorten extreme-expensive factor tests
Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
# tests: avoid test framework failure if the file system lacks ACL support
Patch304: coreutils-test-avoid-FP-when-no-ACL-support.patch
# Upstream patch on top of v8.23 (to be removed in v8.24).
# Fix the dependencies to generate man pages after linking.
Patch400: coreutils-fix-man-deps.patch
# Port upstream patch, to be removed with v8.23:
# ln: with -sr, don't segfault for a TARGET of ''
Patch305: coreutils-ln-avoid-segfault-for-empty-target.patch
# Upstream patch for date(1), to be removed with v8.23:
Patch306: coreutils-date-avoid-crash-in-TZ-parsing.patch
# Upstream patch for shuf(1), to be removed with v8.23:
# shuf --repeat no longer dumps core if the input is empty.
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
# Upstream patch on top of v8.23 (to be removed in v8.24).
# Fixes a regression in chroot which did not chdir("/") in all cases.
Patch401: coreutils-chroot-perform-chdir-unless-skip-chdir.patch
# ================================================
%description
@ -185,11 +151,9 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch16
#
%patch100
%patch110
%patch111
%patch112
%patch113
%patch202
%patch300
@ -197,26 +161,9 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch301
%endif
%patch302
%patch303
%patch304
%patch305
%patch306
%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
%patch400
%patch401
#???## We need to statically link to gmp, otherwise we have a build loop
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in

View File

@ -1,97 +0,0 @@
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

View File

@ -1,120 +0,0 @@
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

View File

@ -1,3 +1,215 @@
-------------------------------------------------------------------
Fri Aug 1 15:54:41 UTC 2014 - mail@bernhard-voelker.de
- Add patches for upstream glitches:
- coreutils-fix-man-deps.patch
- coreutils-chroot-perform-chdir-unless-skip-chdir.patch
- Refresh patches:
- coreutils-build-timeout-as-pie.patch
- coreutils-getaddrinfo.patch
- coreutils-i18n.patch
- coreutils-misc.patch
- coreutils-ocfs2_reflinks.patch
- coreutils-remove_hostname_documentation.patch
- coreutils-remove_kill_documentation.patch
- coreutils-skip-gnulib-test-tls.patch
- coreutils-tests-shorten-extreme-factor-tests.patch
- Remove now-upstream patches:
- coreutils-copy-fix-selinux-existing-dirs.patch
- coreutils-gnulib-tests-ppc64le.patch
- coreutils-tests-avoid-FP-cp-cpuinfo.patch
- coreutils-test-avoid-FP-when-no-ACL-support.patch
- coreutils-ln-avoid-segfault-for-empty-target.patch
- coreutils-date-avoid-crash-in-TZ-parsing.patch
- coreutils-shuf-repeat-avoid-crash-when-input-empty.patch
- 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
- Update to 8.23 (2014-07-18) [stable]
** Bug fixes
chmod -Rc no longer issues erroneous warnings for files with special bits set.
[bug introduced in coreutils-6.0]
cp -a, mv, and install --preserve-context, once again set the correct SELinux
context for existing directories in the destination. Previously they set
the context of an existing directory to that of its last copied descendent.
[bug introduced in coreutils-8.22]
cp -a, mv, and install --preserve-context, no longer seg fault when running
with SELinux enabled, when copying from file systems that return an error
when reading the SELinux context for a file.
[bug introduced in coreutils-8.22]
cp -a and mv now preserve xattrs of symlinks copied across file systems.
[bug introduced with extended attribute preservation feature in coreutils-7.1]
date could crash or go into an infinite loop when parsing a malformed TZ="".
[bug introduced with the --date='TZ="" ..' parsing feature in coreutils-5.3.0]
dd's ASCII and EBCDIC conversions were incompatible with common practice and
with POSIX, and have been corrected as follows. First, conv=ascii now
implies conv=unblock, and conv=ebcdic and conv=ibm now imply conv=block.
Second, the translation tables for dd conv=ascii and conv=ebcdic have been
corrected as shown in the following table, where A is the ASCII value, W is
the old, wrong EBCDIC value, and E is the new, corrected EBCDIC value; all
values are in octal.
A W E
041 117 132
133 112 255
135 132 275
136 137 232
174 152 117
176 241 137
313 232 152
325 255 112
345 275 241
[These dd bugs were present in "the beginning".]
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".]
df now outputs all appropriate entries in the presence of bind mounts.
On some systems, entries would have been incorrectly elided due to
them being considered "dummy" mounts.
[bug introduced in coreutils-8.22]
du now silently ignores directory cycles introduced with bind mounts.
Previously it would issue a warning and exit with a failure status.
[bug introduced in coreutils-8.1]
head --bytes=-N and --lines=-N now handles devices more
consistently, not ignoring data from virtual devices like /dev/zero,
or on BSD systems data from tty devices.
[bug introduced in coreutils-5.0.1]
head --bytes=-N - no longer fails with a bogus diagnostic when stdin's
seek pointer is not at the beginning.
[bug introduced with the --bytes=-N feature in coreutils-5.0.1]
head --lines=-0, when the input does not contain a trailing '\n',
now copies all input to stdout. Previously nothing was output in this case.
[bug introduced with the --lines=-N feature in coreutils-5.0.1]
id, when invoked with no user name argument, now prints the correct group ID.
Previously, in the default output format, it would print the default group ID
in the password database, which may be neither real nor effective. For e.g.,
when run set-GID, or when the database changes outside the current session.
[bug introduced in coreutils-8.1]
ln -sf now replaces symbolic links whose targets can't exist. Previously
it would display an error, requiring --no-dereference to avoid the issue.
[bug introduced in coreutils-5.3.0]
ln -sr '' F no longer segfaults. Now works as expected.
[bug introduced with the --relative feature in coreutils-8.16]
numfmt now handles blanks correctly in all unibyte locales. Previously
in locales where character 0xA0 is a blank, numfmt would mishandle it.
[bug introduced when numfmt was added in coreutils-8.21]
ptx --format long option parsing no longer falls through into the --help case.
[bug introduced in TEXTUTILS-1_22i]
ptx now consistently trims whitespace when processing multiple files.
[This bug was present in "the beginning".]
seq again generates correct output with start or end values = -0.
[bug introduced in coreutils-8.20.]
shuf --repeat no longer dumps core if the input is empty.
[bug introduced with the --repeat feature in coreutils-8.22]
sort when using multiple threads now avoids undefined behavior with mutex
destruction, which could cause deadlocks on some implementations.
[bug introduced in coreutils-8.6]
tail -f now uses polling mode for VXFS to cater for its clustered mode.
[bug introduced with inotify support added in coreutils-7.5]
** New features
od accepts a new option: --endian=TYPE to handle inputs with different byte
orders, or to provide consistent output on systems with disparate endianness.
configure accepts the new option --enable-single-binary to build all the
selected programs in a single binary called "coreutils". The selected
programs can still be called directly using symlinks to "coreutils" or
shebangs with the option --coreutils-prog= passed to this program. The
install behavior is determined by the option --enable-single-binary=symlinks
or --enable-single-binary=shebangs (the default). With the symlinks option,
you can't make a second symlink to any program because that will change the
name of the called program, which is used by coreutils to determine the
desired program. The shebangs option doesn't suffer from this problem, but
the /proc/$pid/cmdline file might not be updated on all the platforms. The
functionality of each program is not affected but this single binary will
depend on all the required dynamic libraries even to run simple programs.
If you desire to build some tools outside the single binary file, you can
pass the option --enable-single-binary-exceptions=PROG_LIST with the comma
separated list of programs you want to build separately. This flag
considerably reduces the overall size of the installed binaries which makes
it suitable for embedded system.
** Changes in behavior
chroot with an argument of "/" no longer implicitly changes the current
directory to "/", allowing changing only user credentials for a command.
chroot --userspec will now unset supplemental groups associated with root,
and instead use the supplemental groups of the specified user.
cut -d$'\n' again outputs lines identified in the --fields list, having
not done so in v8.21 and v8.22. Note using this non portable functionality
will result in the delayed output of lines.
ls with none of LS_COLORS or COLORTERM environment variables set,
will now honor an empty or unknown TERM environment variable,
and not output colors even with --colors=always.
** Improvements
chroot has better --userspec and --group look-ups, with numeric IDs never
causing name look-up errors. Also look-ups are first done outside the chroot,
in case the look-up within the chroot fails due to library conflicts etc.
install now allows the combination of the -D and -t options.
numfmt supports zero padding of numbers using the standard printf
syntax of a leading zero, for example --format="%010f".
Also throughput was improved by up to 800% by avoiding redundant processing.
shred now supports multiple passes on GNU/Linux tape devices by rewinding
the tape before each pass, avoids redundant writes to empty files,
uses direct I/O for all passes where possible, and attempts to clear
inode storage used for small files on some file systems.
split avoids unnecessary input buffering, immediately writing input to output
which is significant with --filter or when writing to fifos or stdout etc.
stat and tail work better with HFS+, HFSX, LogFS and ConfigFS. stat -f
--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.
-------------------------------------------------------------------
Fri Jul 25 23:48:47 CEST 2014 - pth@suse.de

View File

@ -21,7 +21,7 @@ Summary: GNU Core Utilities
License: GPL-3.0+
Group: System/Base
Url: http://www.gnu.org/software/coreutils/
Version: 8.22
Version: 8.23
Release: 0
#################################################################
@ -97,10 +97,6 @@ Patch16: coreutils-invalid-ids.patch
# OBS / RPMLINT require /usr/bin/timeout to be built with the -fpie option.
Patch100: coreutils-build-timeout-as-pie.patch
# Upstream patch to 8.22: cp -a: set the correct SELinux context
# on already existing destination directories.
Patch110: coreutils-copy-fix-selinux-existing-dirs.patch
# At least a bit of reflink support
Patch111: coreutils-ocfs2_reflinks.patch
@ -110,9 +106,6 @@ Patch112: coreutils-getaddrinfo.patch
# Assorted fixes
Patch113: coreutils-misc.patch
# Fix imported gnulib long double math tests for little-endian PowerPC
Patch202: coreutils-gnulib-tests-ppc64le.patch
# Skip 2 valgrind'ed sort tests on ppc/ppc64 which would fail due to
# a glibc issue in mkstemp.
Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
@ -121,43 +114,16 @@ Patch300: coreutils-skip-some-sort-tests-on-ppc.patch
Patch301: coreutils-skip-gnulib-test-tls.patch
%endif
# tests: avoid FP failure when cp fails for /proc/cpuinfo
# which happens e.g. on aarch64.
Patch302: coreutils-tests-avoid-FP-cp-cpuinfo.patch
# tests: shorten extreme-expensive factor tests
Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
# tests: avoid test framework failure if the file system lacks ACL support
Patch304: coreutils-test-avoid-FP-when-no-ACL-support.patch
# Upstream patch on top of v8.23 (to be removed in v8.24).
# Fix the dependencies to generate man pages after linking.
Patch400: coreutils-fix-man-deps.patch
# Port upstream patch, to be removed with v8.23:
# ln: with -sr, don't segfault for a TARGET of ''
Patch305: coreutils-ln-avoid-segfault-for-empty-target.patch
# Upstream patch for date(1), to be removed with v8.23:
Patch306: coreutils-date-avoid-crash-in-TZ-parsing.patch
# Upstream patch for shuf(1), to be removed with v8.23:
# shuf --repeat no longer dumps core if the input is empty.
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
# Upstream patch on top of v8.23 (to be removed in v8.24).
# Fixes a regression in chroot which did not chdir("/") in all cases.
Patch401: coreutils-chroot-perform-chdir-unless-skip-chdir.patch
# ================================================
%description
@ -185,11 +151,9 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch16
#
%patch100
%patch110
%patch111
%patch112
%patch113
%patch202
%patch300
@ -197,26 +161,9 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch301
%endif
%patch302
%patch303
%patch304
%patch305
%patch306
%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
%patch400
%patch401
#???## We need to statically link to gmp, otherwise we have a build loop
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in