From d48e8f2280e65714f1a7faaa3017bd90aef5c3b3 Mon Sep 17 00:00:00 2001 From: liningjie Date: Fri, 24 Nov 2023 17:58:41 +0800 Subject: [PATCH] tests: skip some parts of 'tests/rmdir/ignore.sh' if run as root --- ...parts-of-tests-rmdir-ignore.sh-if-ru.patch | 56 +++++++++++++++++++ coreutils.spec | 6 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch diff --git a/0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch b/0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch new file mode 100644 index 0000000..8f119ae --- /dev/null +++ b/0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch @@ -0,0 +1,56 @@ +From c0e5f8c59b951ae13ca9cb9945cd77163489e1d9 Mon Sep 17 00:00:00 2001 +From: Bernhard Voelker +Date: Fri, 31 Jul 2020 19:49:35 +0200 +Subject: [PATCH] tests: skip some parts of 'tests/rmdir/ignore.sh' if run as + root + +Parts of this test expect that the rmdir syscall returns with EPERM, +but the root user does not see that. + +* tests/rmdir/ignore.sh: Add uid_is_privileged_ guards around parts +of the test which expect rmdir() to fail with EPERM. + +Reported by Nick Alcock in +https://bugs.gnu.org/42633 +--- + tests/rmdir/ignore.sh | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/tests/rmdir/ignore.sh b/tests/rmdir/ignore.sh +index 65e92d012..b26ac533a 100755 +--- a/tests/rmdir/ignore.sh ++++ b/tests/rmdir/ignore.sh +@@ -33,17 +33,24 @@ test -d "$cwd/a/b/c" && fail=1 + # Between 6.11 and 8.31, the following rmdir would mistakenly succeed. + mkdir -p x/y || framework_failure_ + chmod a-w x || framework_failure_ +-returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1 ++ ++if ! uid_is_privileged_; then # root does not get EPERM. ++ returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1 ++fi ++ + test -d x/y || fail=1 + # Between 6.11 and 8.31, the following rmdir would mistakenly fail, + # and also give a non descript error + touch x/y/z || framework_failure_ + rmdir --ignore-fail-on-non-empty x/y || fail=1 + test -d x/y || fail=1 +-# assume empty dir if unreadable entries (so failure to remove diagnosed) +-rm x/y/z || framework_failure_ +-chmod a-r x/y || framework_failure_ +-returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1 +-test -d x/y || fail=1 ++ ++if ! uid_is_privileged_; then # root does not get EPERM. ++ # assume empty dir if unreadable entries (so failure to remove diagnosed) ++ rm x/y/z || framework_failure_ ++ chmod a-r x/y || framework_failure_ ++ returns_ 1 rmdir --ignore-fail-on-non-empty x/y || fail=1 ++ test -d x/y || fail=1 ++fi + + Exit $fail +-- +2.42.0.windows.2 + diff --git a/coreutils.spec b/coreutils.spec index 64cef7f..7cc7997 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 5 +Release: 6 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -37,6 +37,7 @@ Patch19: backport-df-fix-duplicated-remote-entries-due-to-bind-mounts.patch Patch20: backport-df-fix-memory-leak.patch Patch21: backport-ls-avoid-triggering-automounts.patch Patch22: backport-stat-only-automount-with-cached-never.patch +Patch23: 0001-tests-skip-some-parts-of-tests-rmdir-ignore.sh-if-ru.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -155,6 +156,9 @@ fi %{_mandir}/man*/* %changelog +* Fri Nov 24 2023 liningjie - 8.32-6 +- tests: skip some parts of 'tests/rmdir/ignore.sh' if run as root + * Fri Oct 21 2022 jiangchuangang - 8.32-5 - backport some patches from upstream -- Gitee