SHA256
1
0
forked from pool/coreutils

Accepting request 443481 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/443481
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/coreutils?expand=0&rev=121
This commit is contained in:
Dominique Leuenberger 2016-12-05 15:28:40 +00:00 committed by Git OBS Bridge
commit e52c8ac3ec
20 changed files with 1488 additions and 1515 deletions

View File

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

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJWn2zaAAoJEN9v2XEwYDfZvPsP/0o/JM9G7sLXFBX93XO7uYWH
8q2I5hIWcQZiGc/1PZtHM+2GLkh0heiLcKcsY1Ewk/EYlRuGS5MO5M4dh5YHAeaE
LFNfJcAIvClhwgniVXvElTaEfyBDhslh9WVKJCgZ748s6AgDv0SD5dI0X7bpj4Pz
j8wpWaJdrf8kRrjNqhTJtrmO92fUbkULG9+kmp9HZZFYzPUcLyF0ZdA2j3ZxWwP0
OK9zfuY08mVdPVFlPjep1kvNX+See86xDd3HiOkxAJ3oDvHCKPzn8PzREejYAMl+
NfdHovMw85MzaQlYsqduyr9iTBQSOyO6KJ85VM3GEexjxyGqqgwgSXLw9SZgaF9L
pbzAlcvGsFxsOEJF27dllL03SSqMfvDOXs/vRKALzi8jxW/gyGRG3Ft8Dd0pW70w
1vqRwFf/XQuChTUTYsAlshcKu8MPrQbJoU6UPbZOj0odFaWxNQ/E4msoN/NT9Xbi
5buuf43mvUmMXXT+p+fwXiaATn8wuOd4G/Mzc2Q/4zpyUi4MvnmUZ0FD0F39r1WS
jZI2QS8ktpOqV11WArShZLo6X0T9tHHt40/3PLeXJE+RuddU2VR+Yzx3jqUTK8TJ
7S9/DEu+l7dgioZdaXFwS0FcenH4PvRT+V0PwmPMWwrTKDa0G/zrtva488dCJQM7
SUlh/zsEIB3hX2erMwTl
=W+ce
-----END PGP SIGNATURE-----

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

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

17
coreutils-8.26.tar.xz.sig Normal file
View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJYPyRpAAoJEN9v2XEwYDfZ0I4P/3oaPYXMPEOKuDDpEcLumn26
gYIMQc1jIMbBNQe120gQmNPkRr5dTKt5Bap9qYkCj0pI/6VxVIWDo0xrOLYZi7AN
Xgr0kX2qLDFEH+EHkC1BpsAdpsgwfvLmVWPHS62CNKgVDgGiP1cRJZe8oVmlBCiR
3ES7pUsBfDn3hbdKNTTmMDtro1rQMOxfHkVCZLAva+JjdzpE+KTvzZzKkVuZZfJ/
Mi/ZySrXZXFvPBS7GXgop4x8EodyzQMeKO+nvpIUEBY1yLQgCvni5/CBI8w/EViD
DSjj0zWsCQkEjx6HCohi8sBHUYZ+M3lB4rkFk7aevdioPZUGfLkW31LT/cUJC/VV
MIQKWzQtZO/WCJuyEbWP2m25c4MtnnhTm5yoi29yT/CoTRlUWkIQpXm4oD1cJXHy
PpHveu8qM0qRaAtVdXE3pmapIMYUV4g7vxSuCjZRrgiDLhp/K7Lzt5xBhl++kPU2
U9uc202eah4Towo0pbHsuEJT0vk0GGLq8/17dCa/ss8wV+86ZLxl0kZYy4CNEnIW
vsCN6CJ5AoAEVrMN1F7ZJYnH4hoJedvIczThnAkNTqYYE3wnN9stOe28Oy/a0/tg
bt5/Mn0JbmQei890uU8zcEdUjidHqGV4hKk1E2UC4UCyHG/VcHv9gfr8OaD/xPDr
SoauDCHpBU7J7FT/DX+k
=vkKy
-----END PGP SIGNATURE-----

View File

@ -1,304 +0,0 @@
# Upstream patch to improve df performance with many mount points;
# to be removed with coreutils > v8.25.
Upstream patch:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=1c17f61ef9
Downstream addition:
* THANKS: Propagate the addition of Josef Cejka from THANKS.in
to this file (usually done via "make dist").
______________________________________________________________________
From 1c17f61ef993a5ee5fb0d3bc47b7b25782ae386c Mon Sep 17 00:00:00 2001
From: Philipp Thomas <pth@suse.de>
Date: Sun, 31 Jul 2016 21:24:18 +0200
Subject: [PATCH] df: improve performance with many mount points
Use hash table for seaching in filter_mount_list() and get_dev()
This improves performance for 20K mount entries from:
real 0m1.731s
user 0m0.532s
sys 0m1.188s
to:
real 0m1.066s
user 0m0.028s
sys 0m1.032s
* src/df.c (devlist_table): Define hash table.
(devlist_hash): Add hash function.
(devlist_compare): Add hash comparison function.
(devlist_for_dev): Add lookup function.
(devlist_free): Add cleanup function.
(filter_mount_list): Use the above hash table.
While at it, rename the variable 'devlist' to 'seen_dev' for
better readability.
(me_for_dev): Use the above lookup function.
NEWS: Mention the improvement.
THANKS.in: Remove the committer; add original submitter Josef Cejka.
---
NEWS | 3 +
THANKS | 1
THANKS.in | 2 -
src/df.c | 110 +++++++++++++++++++++++++++++++++++++++++++-------------------
4 files changed, 82 insertions(+), 34 deletions(-)
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -8,6 +8,9 @@ GNU coreutils NEWS
introduced in coreutils-8.0. du, chmod, chgrp and chown started using
fts in 6.0. chcon was added in coreutils-6.9.91 with fts support. ]
+ df now filters the system mount list more efficiently, with 20000
+ mount entries now being processed in about 1.1s compared to 1.7s.
+
* Noteworthy changes in release 8.25 (2016-01-20) [stable]
Index: THANKS.in
===================================================================
--- THANKS.in.orig
+++ THANKS.in
@@ -322,6 +322,7 @@ Jon Peatfield J.S.
Joost van Baal joostvb@xs4all.nl
Jordi Pujol jordipujolp@gmail.com
Jorge Stolfi stolfi@ic.unicamp.br
+Josef Cejka jcejka@suse.com
Joseph D. Wagner joe@josephdwagner.info
Joseph S. Myers jsm28@cam.ac.uk
Josh Triplett josh@freedesktop.org
@@ -514,7 +515,6 @@ Petter Reinholdtsen pere
Phelippe Neveu pneveu@pcigeomatics.com
Phil Richards phil.richards@vf.vodafone.co.uk
Philipp Gortan gortan@gmail.com
-Philipp Thomas pth@suse.de
Philippe De Muyter phdm@macqel.be
Philippe Schnoebelen Philippe.Schnoebelen@imag.fr
Phillip Jones mouse@datastacks.com
Index: src/df.c
===================================================================
--- src/df.c.orig
+++ src/df.c
@@ -34,6 +34,7 @@
#include "mountlist.h"
#include "quote.h"
#include "find-mount-point.h"
+#include "hash.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "df"
@@ -43,14 +44,16 @@
proper_name ("David MacKenzie"), \
proper_name ("Paul Eggert")
-/* Filled with device numbers of examined file systems to avoid
- duplicates in output. */
-static struct devlist
+struct devlist
{
dev_t dev_num;
struct mount_entry *me;
struct devlist *next;
-} *device_list;
+};
+
+/* Filled with device numbers of examined file systems to avoid
+ duplicates in output. */
+static Hash_table *devlist_table;
/* If true, show even file systems with zero size or
uninteresting types. */
@@ -603,23 +606,67 @@ excluded_fstype (const char *fstype)
return false;
}
+static size_t
+devlist_hash (void const *x, size_t table_size)
+{
+ struct devlist const *p = x;
+ return (uintmax_t) p->dev_num % table_size;
+}
+
+static bool
+devlist_compare (void const *x, void const *y)
+{
+ struct devlist const *a = x;
+ struct devlist const *b = y;
+ return a->dev_num == b->dev_num;
+}
+
+static struct devlist *
+devlist_for_dev (dev_t dev)
+{
+ if (devlist_table == NULL)
+ return NULL;
+ struct devlist dev_entry;
+ dev_entry.dev_num = dev;
+ return hash_lookup (devlist_table, &dev_entry);
+}
+
+static void
+devlist_free (void *p)
+{
+ free (p);
+}
+
/* Filter mount list by skipping duplicate entries.
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
- the global device_list, rather than filtering the global mount_list. */
+ the global devlist_table, rather than filtering the global mount_list. */
static void
filter_mount_list (bool devices_only)
{
struct mount_entry *me;
+ /* Temporary list to keep entries ordered. */
+ struct devlist *device_list = NULL;
+ int mount_list_size = 0;
+
+ for (me = mount_list; me; me = me->me_next)
+ mount_list_size++;
+
+ devlist_table = hash_initialize (mount_list_size, NULL,
+ devlist_hash,
+ devlist_compare,
+ devlist_free);
+ if (devlist_table == NULL)
+ xalloc_die ();
+
/* 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;
/* Avoid stating remote file systems as that may hang.
@@ -635,21 +682,20 @@ filter_mount_list (bool devices_only)
else
{
/* If we've already seen this device... */
- for (devlist = device_list; devlist; devlist = devlist->next)
- if (devlist->dev_num == buf.st_dev)
- break;
+ struct devlist *seen_dev = devlist_for_dev (buf.st_dev);
- if (devlist)
+ if (seen_dev)
{
- bool target_nearer_root = strlen (devlist->me->me_mountdir)
+ bool target_nearer_root = strlen (seen_dev->me->me_mountdir)
> strlen (me->me_mountdir);
/* With bind mounts, prefer items nearer the root of the source */
- bool source_below_root = devlist->me->me_mntroot != NULL
+ bool source_below_root = seen_dev->me->me_mntroot != NULL
&& me->me_mntroot != NULL
- && (strlen (devlist->me->me_mntroot)
+ && (strlen (seen_dev->me->me_mntroot)
< strlen (me->me_mntroot));
- if (! print_grand_total && me->me_remote && devlist->me->me_remote
- && ! STREQ (devlist->me->me_devname, me->me_devname))
+ if (! print_grand_total
+ && me->me_remote && seen_dev->me->me_remote
+ && ! STREQ (seen_dev->me->me_devname, me->me_devname))
{
/* Don't discard remote entries with different locations,
as these are more likely to be explicitly mounted.
@@ -658,21 +704,21 @@ filter_mount_list (bool devices_only)
}
else if ((strchr (me->me_devname, '/')
/* let "real" devices with '/' in the name win. */
- && ! strchr (devlist->me->me_devname, '/'))
+ && ! strchr (seen_dev->me->me_devname, '/'))
/* let points towards the root of the device win. */
|| (target_nearer_root && ! source_below_root)
/* let an entry overmounted on a new device win... */
- || (! STREQ (devlist->me->me_devname, me->me_devname)
+ || (! STREQ (seen_dev->me->me_devname, me->me_devname)
/* ... but only when matching an existing mnt point,
to avoid problematic replacement when given
inaccurate mount lists, seen with some chroot
environments for example. */
&& STREQ (me->me_mountdir,
- devlist->me->me_mountdir)))
+ seen_dev->me->me_mountdir)))
{
/* Discard mount entry for existing device. */
- discard_me = devlist->me;
- devlist->me = me;
+ discard_me = seen_dev->me;
+ seen_dev->me = me;
}
else
{
@@ -691,12 +737,14 @@ filter_mount_list (bool devices_only)
}
else
{
- /* Add the device number to the global list devlist. */
- devlist = xmalloc (sizeof *devlist);
+ /* Add the device number to the device_table. */
+ struct devlist *devlist = xmalloc (sizeof *devlist);
devlist->me = me;
devlist->dev_num = buf.st_dev;
devlist->next = device_list;
device_list = devlist;
+ if (hash_insert (devlist_table, devlist) == NULL)
+ xalloc_die ();
me = me->me_next;
}
@@ -711,28 +759,24 @@ filter_mount_list (bool devices_only)
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;
+ device_list = device_list->next;
}
+
+ hash_free (devlist_table);
+ devlist_table = NULL;
}
}
+
/* Search a mount entry list for device id DEV.
Return the corresponding mount entry if found or NULL if not. */
static struct mount_entry const * _GL_ATTRIBUTE_PURE
me_for_dev (dev_t dev)
{
- struct devlist *dl = device_list;
-
- while (dl)
- {
- if (dl->dev_num == dev)
+ struct devlist *dl = devlist_for_dev (dev);
+ if (dl)
return dl->me;
- dl = dl->next;
- }
return NULL;
}
Index: THANKS
===================================================================
--- THANKS.orig
+++ THANKS
@@ -406,6 +406,7 @@ Jon Ringuette jonr
Joost van Baal joostvb@xs4all.nl
Jordi Pujol jordipujolp@gmail.com
Jorge Stolfi stolfi@ic.unicamp.br
+Josef Cejka jcejka@suse.com
Joseph D. Wagner joe@josephdwagner.info
Joseph S. Myers jsm28@cam.ac.uk
Josh Triplett josh@freedesktop.org

View File

@ -1,260 +0,0 @@
Upstream patch
- to diagnose readdir() failures in fts-based utilities,
- fixes boo#984910,
- to be removed with coreutils > v8.25,
- consists of the following parts:
1. the fix in thee gnulib submodule
2. the NEWS entry
3. the test added to verify the fix.
4. Upstream coreutils commit to fix the test on 32-bit
----------------------------------------------------------------------
1. Upstream gnulib submodule commit:
http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=6835fc458f30
Taken without the ChangeLog change:
From 6835fc458f30b94f15d69c35a79cbc2dfabe2d06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Wed, 22 Jun 2016 13:49:53 +0100
Subject: [PATCH] fts: handle readdir() errors
* lib/fts.c (fts_build): readdir(3) returns NULL when finished,
but also upon error when it will also set errno. Therefore
flag the error case from readdir(). We treat the case where
no items are read the same as if the dir can't be accessed,
i.e. by setting fts_errno to FTS_DNR.
The bug was initially reported by Peter Benie
http://bugzilla.opensuse.org/show_bug.cgi?id=984910
where it was mentioned that readdir() may fail
when an NFS server has a poor readdir cookie implementation.
----------------------------------------------------------------------
2. Upstream coreutils commit:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=ef9650170f79
Take the NEWS change only, as the fix in fts.c was already
pulled in with the above gnulib commit.
From ef9650170f795be41223c8887258a1c596ecc162 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Sun, 26 Jun 2016 20:58:41 +0100
Subject: [PATCH] all: update gnulib submodule and tests/init.sh to latest
* NEWS: Specifically mention the fts readdir() fix.
----------------------------------------------------------------------
3. Upstream coreutils commit to add a test:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=26616776c0c6
From 26616776c0c620ce72b3b69aa5ed63f495552a9e Mon Sep 17 00:00:00 2001
From: Peter Benie <pjb1008@cam.ac.uk>
Date: Sun, 26 Jun 2016 19:07:45 +0100
Subject: [PATCH] tests: verify that fts diagnoses readdir() failures
* tests/rm/rm-readdir-fail.sh: A new test to simulate readdir()
failing immediately or after returning a few entries, and verifying
that rm does the appropriate thing.
This was initially reported at:
http://bugzilla.opensuse.org/show_bug.cgi?id=984910
where it was mentioned that readdir() may fail
when an NFS server has a poor readdir cookie implementation.
----------------------------------------------------------------------
4. Upstream coreutils commit to fix the test on 32-bit
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=54c1397510cb
From 54c1397510cb08433680b5b7da46a8201770e9ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Wed, 6 Jul 2016 18:08:32 +0100
Subject: [PATCH] tests: avoid false failure on 32 bit in readdir() test
* tests/rm/rm-readdir-fail.sh: Since we use the returned dirent
from the readdir wrapper it must be the correct type and not
just cast. Therefore setup so that we only have to define a
wrapper for readdir(), which works appropriately on 32 and 64 bit.
Issue reported by Bernhard Voelker, where rm was seen to invoke
rmdir() on invalid file names.
----------------------------------------------------------------------
---
NEWS | 9 +++
lib/fts.c | 14 ++++-
tests/local.mk | 1
tests/rm/rm-readdir-fail.sh | 107 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 129 insertions(+), 2 deletions(-)
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -1,5 +1,14 @@
GNU coreutils NEWS -*- outline -*-
+* Noteworthy downstream / openSUSE changes
+
+ chcon, chgrp, chmod, chown, du, and rm, or specifically utilities
+ using the FTS interface, now diagnose failures returned by readdir().
+ [this bug was inherent in the use of fts: thus, for rm the bug was
+ introduced in coreutils-8.0. du, chmod, chgrp and chown started using
+ fts in 6.0. chcon was added in coreutils-6.9.91 with fts support. ]
+
+
* Noteworthy changes in release 8.25 (2016-01-20) [stable]
** Bug fixes
Index: lib/fts.c
===================================================================
--- lib/fts.c.orig
+++ lib/fts.c
@@ -1461,9 +1461,18 @@ fts_build (register FTS *sp, int type)
while (cur->fts_dirp) {
bool is_dir;
size_t d_namelen;
+ __set_errno (0);
struct dirent *dp = readdir(cur->fts_dirp);
- if (dp == NULL)
+ if (dp == NULL) {
+ if (errno) {
+ cur->fts_errno = errno;
+ /* If we've not read any items yet, treat
+ the error as if we can't access the dir. */
+ cur->fts_info = (continue_readdir || nitems)
+ ? FTS_ERR : FTS_DNR;
+ }
break;
+ }
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
@@ -1622,7 +1631,8 @@ mem1: saved_er
/* If didn't find anything, return NULL. */
if (!nitems) {
- if (type == BREAD)
+ if (type == BREAD
+ && cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
cur->fts_info = FTS_DP;
fts_lfree(head);
return (NULL);
Index: tests/local.mk
===================================================================
--- tests/local.mk.orig
+++ tests/local.mk
@@ -223,6 +223,7 @@ all_tests = \
tests/rm/unreadable.pl \
tests/rm/v-slash.sh \
tests/rm/many-dir-entries-vs-OOM.sh \
+ tests/rm/rm-readdir-fail.sh \
tests/chgrp/default-no-deref.sh \
tests/chgrp/deref.sh \
tests/chgrp/no-x.sh \
Index: tests/rm/rm-readdir-fail.sh
===================================================================
--- /dev/null
+++ tests/rm/rm-readdir-fail.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+# Test rm's behaviour when the directory cannot be read.
+# This test is skipped on systems that lack LD_PRELOAD support.
+
+# Copyright (C) 2016 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_ rm
+require_gcc_shared_
+
+mkdir -p dir/notempty || framework_failure_
+
+# Simulate "readdir" failure.
+cat > k.c <<\EOF || framework_failure_
+#define _GNU_SOURCE
+
+/* Setup so we don't have to worry about readdir64. */
+#ifndef __LP64__
+# define _FILE_OFFSET_BITS 64
+#endif
+
+#include <dlfcn.h>
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+struct dirent *readdir (DIR *dirp)
+{
+ static struct dirent *(*real_readdir)(DIR *dirp);
+ if (! real_readdir && ! (real_readdir = dlsym (RTLD_NEXT, "readdir")))
+ {
+ fprintf (stderr, "Failed to find readdir()\n");
+ errno = ESRCH;
+ return NULL;
+ }
+ static struct dirent* d;
+ if (! d && ! ( d = real_readdir (dirp)))
+ {
+ fprintf (stderr, "Failed to get dirent\n");
+ errno = ENOENT;
+ return NULL;
+ }
+
+ /* Flag that LD_PRELOAD and above functions work. */
+ static int count = 1;
+ if (count == 1)
+ fclose (fopen ("preloaded", "w"));
+
+ /* Return some entries to trigger partial read failure,
+ ensuring we don't return ignored '.' or '..' */
+ char const *readdir_partial = getenv ("READDIR_PARTIAL");
+ if (readdir_partial && *readdir_partial && count <= 3)
+ {
+ count++;
+ d->d_name[0]='0'+count; d->d_name[1]='\0';
+#ifdef _DIRENT_HAVE_D_NAMLEN
+ _D_EXACT_NAMELEN(d)=2;
+#endif
+ errno = 0;
+ return d;
+ };
+
+ /* Fail. */
+ errno = ENOENT;
+ return NULL;
+}
+EOF
+
+# Then compile/link it:
+gcc_shared_ k.c k.so \
+ || framework_failure_ 'failed to build shared library'
+
+# Test if LD_PRELOAD works:
+export READDIR_PARTIAL
+for READDIR_PARTIAL in '' '1'; do
+ rm -f preloaded
+ (LD_PRELOAD=$LD_PRELOAD:./k.so returns_ 1 rm -Rf dir 2>>err) || fail=1
+ test -f preloaded ||
+ skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
+done
+
+# First case is failure to read any items from dir, then assume empty.
+# Generally that will be diagnosed when rm tries to rmdir().
+# Second case is more general error where we fail immediately
+# (with ENOENT in this case but it could be anything).
+cat <<EOF > exp
+rm: cannot remove 'dir': Directory not empty
+rm: traversal failed: dir: No such file or directory
+EOF
+
+compare exp err || fail=1
+
+Exit $fail

File diff suppressed because it is too large Load Diff

View File

@ -19,12 +19,12 @@ Index: src/chgrp.c
===================================================================
--- src/chgrp.c.orig
+++ src/chgrp.c
@@ -88,7 +88,7 @@ parse_group (const char *name)
@@ -89,7 +89,7 @@ parse_group (const char *name)
{
unsigned long int tmp;
if (! (xstrtoul (name, NULL, 10, &tmp, "") == LONGINT_OK
- && tmp <= GID_T_MAX))
+ && tmp <= GID_T_MAX && (gid_t) tmp != (gid_t) -1))
error (EXIT_FAILURE, 0, _("invalid group: %s"),
quote (name));
die (EXIT_FAILURE, 0, _("invalid group: %s"),
quote (name));
gid = tmp;

View File

@ -1,157 +0,0 @@
Upstream patch to fix "md5sum --check --ignore-missing" which treated
files with checksums starting with "00" as missing.
To be removed with coreutils > v8.25.
Test case illustrating the issue:
$ echo 559 > file
$ md5sum file | tee file.md5
000b64c5d808b7ae98718d6a191325b7 file
With the file being intact, md5sum previously issued a misleading error
diagnostic, and returned with exit code 1.
$ md5sum -c --ignore-missing file.md5; echo $?
md5sum: file.md5: no file was verified
1
With the file being changed, md5sum still detected the changed file ("FAILED"),
but still stated that the file was not checked; at least the exit code was okay.
$ echo tampered >> file
$ md5sum -c --ignore-missing file.md5; echo $?
file: FAILED
md5sum: WARNING: 1 computed checksum did NOT match
md5sum: file.md5: no file was verified
1
Original patch:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=d0ddfadfb27de
From d0ddfadfb27def2861f35b1a45190a4c1780b257 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Wed, 26 Oct 2016 15:45:01 +0100
Subject: [PATCH] md5sum,sha*sum: fix --ignore-missing with checksums starting
with 00
* NEWS: Mention the fix.
* src/md5sum.c (digest_file): Add a new MISSING parameter to
return whether the file was missing, separately from the digest.
* tests/misc/md5sum.pl: Add a test case.
Fixes http://bugs.gnu.org/24795
---
NEWS | 4 ++++
src/md5sum.c | 20 ++++++++++++--------
tests/misc/md5sum.pl | 7 +++++++
3 files changed, 23 insertions(+), 8 deletions(-)
Index: NEWS
===================================================================
--- NEWS.orig
+++ NEWS
@@ -11,6 +11,10 @@ GNU coreutils NEWS
df now filters the system mount list more efficiently, with 20000
mount entries now being processed in about 1.1s compared to 1.7s.
+ md5sum --check --ignore-missing no longer treats files with checksums
+ starting with "00" as missing. This also affects sha*sum.
+ [bug introduced with the --ignore-missing feature in coreutils-8.25]
+
* Noteworthy changes in release 8.25 (2016-01-20) [stable]
Index: src/md5sum.c
===================================================================
--- src/md5sum.c.orig
+++ src/md5sum.c
@@ -462,15 +462,19 @@ print_filename (char const *file, bool e
text because it was a terminal.
Put the checksum in *BIN_RESULT, which must be properly aligned.
+ Put true in *MISSING if the file can't be opened due to ENOENT.
Return true if successful. */
static bool
-digest_file (const char *filename, int *binary, unsigned char *bin_result)
+digest_file (const char *filename, int *binary, unsigned char *bin_result,
+ bool *missing)
{
FILE *fp;
int err;
bool is_stdin = STREQ (filename, "-");
+ *missing = false;
+
if (is_stdin)
{
have_read_stdin = true;
@@ -490,7 +494,7 @@ digest_file (const char *filename, int *
{
if (ignore_missing && errno == ENOENT)
{
- *bin_result = '\0';
+ *missing = true;
return true;
}
error (0, errno, "%s", quotef (filename));
@@ -603,14 +607,14 @@ digest_check (const char *checkfile_name
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f' };
bool ok;
+ bool missing;
/* Only escape in the edge case producing multiple lines,
to ease automatic processing of status output. */
bool needs_escape = ! status_only && strchr (filename, '\n');
properly_formatted_lines = true;
- *bin_buffer = '\1'; /* flag set to 0 for ignored missing files. */
- ok = digest_file (filename, &binary, bin_buffer);
+ ok = digest_file (filename, &binary, bin_buffer, &missing);
if (!ok)
{
@@ -623,10 +627,9 @@ digest_check (const char *checkfile_name
printf (": %s\n", _("FAILED open or read"));
}
}
- else if (ignore_missing && ! *bin_buffer)
+ else if (ignore_missing && missing)
{
- /* Treat an empty buffer as meaning a missing file,
- which is ignored with --ignore-missing. */
+ /* Ignore missing files with --ignore-missing. */
;
}
else
@@ -876,8 +879,9 @@ main (int argc, char **argv)
else
{
int file_is_binary = binary;
+ bool missing;
- if (! digest_file (file, &file_is_binary, bin_buffer))
+ if (! digest_file (file, &file_is_binary, bin_buffer, &missing))
ok = false;
else
{
Index: tests/misc/md5sum.pl
===================================================================
--- tests/misc/md5sum.pl.orig
+++ tests/misc/md5sum.pl
@@ -149,6 +149,13 @@ my @Tests =
{ERR=>
"md5sum: f.md5: no file was verified\n"},
{EXIT=> 1}],
+ # coreutils-8.25 with --ignore-missing treated checksums starting with 00
+ # as if the file was not present
+ ['check-ignore-missing-6', '--check', '--ignore-missing',
+ {AUX=> {f=> '9t'}},
+ {IN=> {'f.md5' =>
+ "006999e6df389641adf1fa3a74801d9d f\n"}},
+ {OUT=>"f: OK\n"}],
['bsd-segv', '--check', {IN=> {'z' => "MD5 ("}}, {EXIT=> 1},
{ERR=> "$prog: z: no properly formatted MD5 checksum lines found\n"}],

View File

@ -1,70 +0,0 @@
Upstream patch to fix the build dependency between src/arch -> man/arch.1;
to be removed with coreutils > v8.25.
Downstream addition:
* Propagate the change from local.mk to Makefile.in, which is done
upstreams by autoconf.
Original patch:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=a69e54cfdf7e
From a69e54cfdf7e5d8c2c3fe315ded649272d7e8711 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Tue, 26 Jul 2016 20:58:08 +0200
Subject: [PATCH] maint: fix dependency of man/arch.1
The following is a reproducer for the wrong dependency:
$ ./configure --enable-install-program=arch
$ make
$ rm -f src/arch man/arch.1
$ make man/arch.1
GEN man/arch.1
help2man: can't get `--help' info from man/arch.td/arch
Try `--no-discard-stderr' if option outputs to stderr
Makefile:14378: recipe for target 'man/arch.1' failed
make: *** [man/arch.1] Error 127
* man/local.mk (man/arch.1): Change to depend on src/arch rather than
src/uname: while the arch binary depends on uname.c and uname-arch.c,
its man page depends on the arch binary.
Reported downstream by Rodrigues Goldwyn <rgoldwyn@suse.com> in
https://build.opensuse.org/request/show/415172
---
Makefile.in | 2 +-
man/local.mk | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: man/local.mk
===================================================================
--- man/local.mk.orig
+++ man/local.mk
@@ -56,10 +56,10 @@ if SINGLE_BINARY
mandeps += src/coreutils$(EXEEXT)
else
# Most prog.1 man pages depend on src/prog. List the exceptions:
-man/arch.1: src/uname$(EXEEXT)
man/install.1: src/ginstall$(EXEEXT)
man/test.1: src/[$(EXEEXT)
+man/arch.1: src/arch$(EXEEXT)
man/base32.1: src/base32$(EXEEXT)
man/base64.1: src/base64$(EXEEXT)
man/basename.1: src/basename$(EXEEXT)
Index: Makefile.in
===================================================================
--- Makefile.in.orig
+++ Makefile.in
@@ -14276,10 +14276,10 @@ distclean-local:
$(ALL_MANS): $(mandeps)
# Most prog.1 man pages depend on src/prog. List the exceptions:
-@SINGLE_BINARY_FALSE@man/arch.1: src/uname$(EXEEXT)
@SINGLE_BINARY_FALSE@man/install.1: src/ginstall$(EXEEXT)
@SINGLE_BINARY_FALSE@man/test.1: src/[$(EXEEXT)
+@SINGLE_BINARY_FALSE@man/arch.1: src/arch$(EXEEXT)
@SINGLE_BINARY_FALSE@man/base32.1: src/base32$(EXEEXT)
@SINGLE_BINARY_FALSE@man/base64.1: src/base64$(EXEEXT)
@SINGLE_BINARY_FALSE@man/basename.1: src/basename$(EXEEXT)

View File

@ -18,7 +18,7 @@ Index: src/copy.c
===================================================================
--- src/copy.c.orig
+++ src/copy.c
@@ -315,6 +315,47 @@ sparse_copy (int src_fd, int dest_fd, ch
@@ -324,6 +324,47 @@ sparse_copy (int src_fd, int dest_fd, ch
return true;
}
@ -66,7 +66,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
@@ -1049,6 +1090,45 @@ copy_reg (char const *src_name, char con
@@ -1054,6 +1095,45 @@ copy_reg (char const *src_name, char con
goto close_src_desc;
}
@ -112,7 +112,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)
@@ -1192,7 +1272,7 @@ copy_reg (char const *src_name, char con
@@ -1197,7 +1277,7 @@ copy_reg (char const *src_name, char con
}
/* --attributes-only overrides --reflink. */

View File

@ -6,7 +6,7 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -69,7 +69,6 @@
@@ -70,7 +70,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.
@ -14,7 +14,7 @@ Index: doc/coreutils.texi
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
@@ -201,7 +200,7 @@ Free Documentation License''.
@@ -202,7 +201,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
@@ -421,7 +420,6 @@ System context
@@ -423,7 +422,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
@@ -14986,7 +14984,6 @@ information.
@@ -15073,7 +15071,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
@@ -15815,15 +15812,6 @@ Note this is non-portable (even across G
@@ -15912,15 +15909,6 @@ Note this is non-portable (even across G
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
@@ -15877,34 +15865,6 @@ Print the kernel version.
@@ -15974,34 +15962,6 @@ Print the kernel version.
@exitstatus

View File

@ -6,7 +6,7 @@ Index: doc/coreutils.texi
===================================================================
--- doc/coreutils.texi.orig
+++ doc/coreutils.texi
@@ -72,7 +72,6 @@
@@ -73,7 +73,6 @@
* id: (coreutils)id invocation. Print user identity.
* install: (coreutils)install invocation. Copy files and set attributes.
* join: (coreutils)join invocation. Join lines on a common field.
@ -14,7 +14,7 @@ Index: doc/coreutils.texi
* 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.
@@ -203,7 +202,6 @@ Free Documentation License''.
@@ -204,7 +203,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 numfmt seq
* File permissions:: Access modes
@@ -448,10 +446,6 @@ Modified command invocation
@@ -450,10 +448,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
@@ -16799,90 +16793,6 @@ the exit status of @var{command} otherwi
@@ -16896,90 +16890,6 @@ the exit status of @var{command} otherwi
@end display

View File

@ -21,7 +21,7 @@ Index: gnulib-tests/gnulib.mk
===================================================================
--- gnulib-tests/gnulib.mk.orig
+++ gnulib-tests/gnulib.mk
@@ -2242,9 +2242,10 @@ EXTRA_DIST += test-timespec.c macros.h
@@ -2243,9 +2243,10 @@ EXTRA_DIST += test-timespec.c macros.h
## begin gnulib module tls-tests

View File

@ -6,7 +6,7 @@ Index: src/uname.c
===================================================================
--- src/uname.c.orig
+++ src/uname.c
@@ -337,6 +337,36 @@ main (int argc, char **argv)
@@ -338,6 +338,36 @@ main (int argc, char **argv)
# endif
}
#endif
@ -43,7 +43,7 @@ Index: src/uname.c
if (! (toprint == UINT_MAX && element == unknown))
print_element (element);
}
@@ -362,6 +392,18 @@ main (int argc, char **argv)
@@ -363,6 +393,18 @@ main (int argc, char **argv)
element = hardware_platform;
}
#endif

View File

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

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Fri Dec 2 17:17:40 UTC 2016 - mail@bernhard-voelker.de
- Update to 8.26
(for details see included NEWS file)
- coreutils.spec (%description): Add b2sum, a new utility.
(BuildRequires): Add timezone to enable new 'date-debug.sh' test.
- coreutils-i18n.patch: Sync I18N patch from Fedora, as the diff
for the old i18n implementation of expand/unexpand has become
unmaintainable:
git://pkgs.fedoraproject.org/coreutils.git
- Remove now-upstream patches:
* coreutils-df-hash-in-filter.patch
* coreutils-diagnose-fts-readdir-failure.patch
* coreutils-m5sum-sha-sum-fix-ignore-missing-with-00-checksums.patch
* coreutils-maint-fix-dependency-of-man-arch.1.patch
- Refresh/merge all other patches:
* coreutils-invalid-ids.patch
* coreutils-ocfs2_reflinks.patch
* coreutils-remove_hostname_documentation.patch
* coreutils-remove_kill_documentation.patch
* coreutils-skip-gnulib-test-tls.patch
* coreutils-sysinfo.patch
* coreutils-tests-shorten-extreme-factor-tests.patch
-------------------------------------------------------------------
Tue Nov 1 09:41:12 UTC 2016 - mail@bernhard-voelker.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.25
Version: 8.26
Release: 0
#################################################################
@ -52,6 +52,7 @@ BuildRequires: gdb
BuildRequires: perl-Expect
BuildRequires: python-pyinotify
BuildRequires: strace
BuildRequires: timezone
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l armv7hl
BuildRequires: valgrind
%endif
@ -128,30 +129,13 @@ Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
Patch500: coreutils-disable_tests.patch
Patch501: coreutils-test_without_valgrind.patch
# Upstream patch to diagnose readdir() failures in fts-based utilities;
# to be removed with coreutils > v8.25.
Patch700: coreutils-diagnose-fts-readdir-failure.patch
# Upstream patch to improve df performance with many mount points;
# to be removed with coreutils > v8.25.
Patch705: coreutils-df-hash-in-filter.patch
# Upstream patch to fix the build dependency between src/arch -> man/arch.1;
# to be removed with coreutils > v8.25.
Patch710: coreutils-maint-fix-dependency-of-man-arch.1.patch
# Upstream patch to fix "md5sum --check --ignore-missing" which treated
# files with checksums starting with "00" as missing;
# to be removed with coreutils > v8.25.
Patch715: coreutils-m5sum-sha-sum-fix-ignore-missing-with-00-checksums.patch
# ================================================
%description
These are the GNU core utilities. This package is the union of
the GNU fileutils, sh-utils, and textutils packages.
[ arch base32 base64 basename cat chcon chgrp chmod chown chroot cksum comm
cp csplit cut date dd df dir dircolors dirname du echo env expand expr
[ arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false fmt fold groups head hostid id install join
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink
@ -187,11 +171,6 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch500
%patch501
%patch700
%patch705
%patch710
%patch715
#???## We need to statically link to gmp, otherwise we have a build loop
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
@ -231,7 +210,7 @@ make all %{?_smp_mflags} V=1
%if "%{name}" == "coreutils"
make install DESTDIR="%buildroot" pkglibexecdir=%{_libdir}/%{name}
# remove kill
# remove kill - we use that from util-linux.
rm -v %{buildroot}%{_bindir}/kill
rm -v %{buildroot}/%{_mandir}/man1/kill.1

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Fri Dec 2 17:17:40 UTC 2016 - mail@bernhard-voelker.de
- Update to 8.26
(for details see included NEWS file)
- coreutils.spec (%description): Add b2sum, a new utility.
(BuildRequires): Add timezone to enable new 'date-debug.sh' test.
- coreutils-i18n.patch: Sync I18N patch from Fedora, as the diff
for the old i18n implementation of expand/unexpand has become
unmaintainable:
git://pkgs.fedoraproject.org/coreutils.git
- Remove now-upstream patches:
* coreutils-df-hash-in-filter.patch
* coreutils-diagnose-fts-readdir-failure.patch
* coreutils-m5sum-sha-sum-fix-ignore-missing-with-00-checksums.patch
* coreutils-maint-fix-dependency-of-man-arch.1.patch
- Refresh/merge all other patches:
* coreutils-invalid-ids.patch
* coreutils-ocfs2_reflinks.patch
* coreutils-remove_hostname_documentation.patch
* coreutils-remove_kill_documentation.patch
* coreutils-skip-gnulib-test-tls.patch
* coreutils-sysinfo.patch
* coreutils-tests-shorten-extreme-factor-tests.patch
-------------------------------------------------------------------
Tue Nov 1 09:41:12 UTC 2016 - mail@bernhard-voelker.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.25
Version: 8.26
Release: 0
#################################################################
@ -52,6 +52,7 @@ BuildRequires: gdb
BuildRequires: perl-Expect
BuildRequires: python-pyinotify
BuildRequires: strace
BuildRequires: timezone
%ifarch %ix86 x86_64 ppc ppc64 s390x armv7l armv7hl
BuildRequires: valgrind
%endif
@ -128,30 +129,13 @@ Patch303: coreutils-tests-shorten-extreme-factor-tests.patch
Patch500: coreutils-disable_tests.patch
Patch501: coreutils-test_without_valgrind.patch
# Upstream patch to diagnose readdir() failures in fts-based utilities;
# to be removed with coreutils > v8.25.
Patch700: coreutils-diagnose-fts-readdir-failure.patch
# Upstream patch to improve df performance with many mount points;
# to be removed with coreutils > v8.25.
Patch705: coreutils-df-hash-in-filter.patch
# Upstream patch to fix the build dependency between src/arch -> man/arch.1;
# to be removed with coreutils > v8.25.
Patch710: coreutils-maint-fix-dependency-of-man-arch.1.patch
# Upstream patch to fix "md5sum --check --ignore-missing" which treated
# files with checksums starting with "00" as missing;
# to be removed with coreutils > v8.25.
Patch715: coreutils-m5sum-sha-sum-fix-ignore-missing-with-00-checksums.patch
# ================================================
%description
These are the GNU core utilities. This package is the union of
the GNU fileutils, sh-utils, and textutils packages.
[ arch base32 base64 basename cat chcon chgrp chmod chown chroot cksum comm
cp csplit cut date dd df dir dircolors dirname du echo env expand expr
[ arch b2sum base32 base64 basename cat chcon chgrp chmod chown chroot cksum
comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr
factor false fmt fold groups head hostid id install join
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup
nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink
@ -187,11 +171,6 @@ the GNU fileutils, sh-utils, and textutils packages.
%patch500
%patch501
%patch700
%patch705
%patch710
%patch715
#???## We need to statically link to gmp, otherwise we have a build loop
#???#sed -i s,'$(LIB_GMP)',%%{_libdir}/libgmp.a,g Makefile.in
@ -231,7 +210,7 @@ make all %{?_smp_mflags} V=1
%if "%{name}" == "coreutils"
make install DESTDIR="%buildroot" pkglibexecdir=%{_libdir}/%{name}
# remove kill
# remove kill - we use that from util-linux.
rm -v %{buildroot}%{_bindir}/kill
rm -v %{buildroot}/%{_mandir}/man1/kill.1