import coreutils-8.30-9.el8

This commit is contained in:
CentOS Sources 2021-05-19 16:09:51 +00:00 committed by Andrew Lukoshko
parent f3e1fd7121
commit 7f7a2b1711
4 changed files with 1582 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
From 11b37b65d08c2a8b6d967fd866ebbdbe7e864949 Mon Sep 17 00:00:00 2001
From: Nishant Nayan <nishant.nayan@oracle.com>
Date: Thu, 26 Nov 2020 14:35:17 +0000
Subject: [PATCH] rm: do not skip files upon failure to remove an empty dir
When removing a directory fails for some reason, and that directory
is empty, the rm_fts code gets the return value of the excise call
confused with the return value of its earlier call to prompt,
causing fts_skip_tree to be called again and the next file
that rm would otherwise have deleted to survive.
* src/remove.c (rm_fts): Ensure we only skip a single fts entry,
when processing empty dirs. I.e. only skip the entry
having successfully removed it.
* tests/rm/empty-immutable-skip.sh: New root-only test.
* tests/local.mk: Add it.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/44883
Upstream-commit: 6bf108358a6104ec1c694c9530b3cd56b95f4b57
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/remove.c | 3 ++-
tests/local.mk | 1 +
tests/rm/empty-immutable-skip.sh | 46 ++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+), 1 deletion(-)
create mode 100755 tests/rm/empty-immutable-skip.sh
diff --git a/src/remove.c b/src/remove.c
index 2d40c55..adf9489 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -506,7 +506,8 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x)
/* When we know (from prompt when in interactive mode)
that this is an empty directory, don't prompt twice. */
s = excise (fts, ent, x, true);
- fts_skip_tree (fts, ent);
+ if (s == RM_OK)
+ fts_skip_tree (fts, ent);
}
if (s != RM_OK)
diff --git a/tests/local.mk b/tests/local.mk
index 5f7f775..2aeff2b 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -136,6 +136,7 @@ all_root_tests = \
tests/rm/no-give-up.sh \
tests/rm/one-file-system.sh \
tests/rm/read-only.sh \
+ tests/rm/empty-immutable-skip.sh \
tests/tail-2/append-only.sh \
tests/tail-2/end-of-device.sh \
tests/touch/now-owned-by-other.sh
diff --git a/tests/rm/empty-immutable-skip.sh b/tests/rm/empty-immutable-skip.sh
new file mode 100755
index 0000000..c91d8d4
--- /dev/null
+++ b/tests/rm/empty-immutable-skip.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Ensure that rm does not skip extra files after hitting an empty immutable dir.
+# Requires root access to do chattr +i, as well as an ext[23] or xfs file system
+
+# Copyright (C) 2020 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 <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ rm
+require_root_
+
+# These simple one-file operations are expected to work even in the
+# presence of this bug, and we need them to set up the rest of the test.
+chattr_i_works=1
+touch f
+chattr +i f 2>/dev/null || chattr_i_works=0
+rm f 2>/dev/null
+test -f f || chattr_i_works=0
+chattr -i f 2>/dev/null || chattr_i_works=0
+rm f 2>/dev/null || chattr_i_works=0
+test -f f && chattr_i_works=0
+
+if test $chattr_i_works = 0; then
+ skip_ "chattr +i doesn't work on this file system"
+fi
+
+mkdir empty || framework_failure_
+touch x y || framework_failure_
+chattr +i empty || framework_failure_
+rm -rf empty x y
+{ test -f x || test -f y; } && fail=1
+chattr -i empty
+
+Exit $fail
--
2.26.2

View File

@ -0,0 +1,100 @@
From bb0e7fabcaed9a7e71e30f05e638e9f243cdb13e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Mon, 25 Jan 2021 14:12:48 +0000
Subject: [PATCH] split: fix --number=K/N to output correct part of file
This functionality regressed with the adjustments
in commit v8.25-4-g62e7af032
* src/split.c (bytes_chunk_extract): Account for already read data
when seeking into the file.
* tests/split/b-chunk.sh: Use the hidden ---io-blksize option,
to test this functionality.
Fixes https://bugs.gnu.org/46048
Upstream-commit: bb21daa125aeb4e32546309d370918ca47e612db
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/split.c | 2 +-
tests/split/b-chunk.sh | 45 ++++++++++++++++++++++++------------------
2 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/src/split.c b/src/split.c
index 09e610b..19248f6 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
}
else
{
- if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
+ if (lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0)
die (EXIT_FAILURE, errno, "%s", quotef (infile));
initial_read = SIZE_MAX;
}
diff --git a/tests/split/b-chunk.sh b/tests/split/b-chunk.sh
index 864ce55..39a6799 100755
--- a/tests/split/b-chunk.sh
+++ b/tests/split/b-chunk.sh
@@ -35,32 +35,39 @@ split -e -n 10 /dev/null || fail=1
returns_ 1 stat x?? 2>/dev/null || fail=1
printf '1\n2\n3\n4\n5\n' > input || framework_failure_
+printf '1\n2' > exp-1 || framework_failure_
+printf '\n3\n' > exp-2 || framework_failure_
+printf '4\n5\n' > exp-3 || framework_failure_
for file in input /proc/version /sys/kernel/profiling; do
test -f $file || continue
- split -n 3 $file > out || fail=1
- split -n 1/3 $file > b1 || fail=1
- split -n 2/3 $file > b2 || fail=1
- split -n 3/3 $file > b3 || fail=1
+ for blksize in 1 2 4096; do
+ if ! test "$file" = 'input'; then
+ # For /proc like files we must be able to read all
+ # into the internal buffer to be able to determine size.
+ test "$blksize" = 4096 || continue
+ fi
- case $file in
- input)
- printf '1\n2' > exp-1
- printf '\n3\n' > exp-2
- printf '4\n5\n' > exp-3
+ split -n 3 ---io-blksize=$blksize $file > out || fail=1
+ split -n 1/3 ---io-blksize=$blksize $file > b1 || fail=1
+ split -n 2/3 ---io-blksize=$blksize $file > b2 || fail=1
+ split -n 3/3 ---io-blksize=$blksize $file > b3 || fail=1
- compare exp-1 xaa || fail=1
- compare exp-2 xab || fail=1
- compare exp-3 xac || fail=1
- ;;
- esac
+ case $file in
+ input)
+ compare exp-1 xaa || fail=1
+ compare exp-2 xab || fail=1
+ compare exp-3 xac || fail=1
+ ;;
+ esac
- compare xaa b1 || fail=1
- compare xab b2 || fail=1
- compare xac b3 || fail=1
- cat xaa xab xac | compare - $file || fail=1
- test -f xad && fail=1
+ compare xaa b1 || fail=1
+ compare xab b2 || fail=1
+ compare xac b3 || fail=1
+ cat xaa xab xac | compare - $file || fail=1
+ test -f xad && fail=1
+ done
done
Exit $fail
--
2.26.2

View File

@ -1,7 +1,7 @@
Summary: A set of basic GNU tools commonly used in shell scripts
Name: coreutils
Version: 8.30
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: https://www.gnu.org/software/coreutils/
@ -35,6 +35,15 @@ Patch6: coreutils-8.31-sums-man-pages.patch
# df --local: recognize afs, auristorfs, and smb3 as remote fs (#1798030)
Patch7: coreutils-8.30-df-local-fs.patch
# use statx instead of stat when available (#1760300)
Patch8: coreutils-8.30-statx.patch
# rm: do not skip files upon failure to remove an empty dir (#1905481)
Patch9: coreutils-8.32-rm-stray-skip.patch
# split: fix --number=K/N to output correct part of file (#1921246)
Patch10: coreutils-8.32-split-number.patch
# disable the test-lock gnulib test prone to deadlock
Patch100: coreutils-8.26-test-lock.patch
@ -268,6 +277,11 @@ fi
%license COPYING
%changelog
* Fri Mar 26 2021 Kamil Dudka <kdudka@redhat.com> - 8.30-9
- split: fix --number=K/N to output correct part of file (#1921246)
- rm: do not skip files upon failure to remove an empty dir (#1905481)
- use statx instead of stat when available (#1760300)
* Tue Apr 14 2020 Kamil Dudka <kdudka@redhat.com> - 8.30-8
- df --local: recognize afs, auristorfs, and smb3 as remote fs (#1798030)
- fix formatting of sha512sum(1) man page (#1688744)