From 9b583c6e09727a6b5f69345eb84025dd664b8363 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Mon, 17 May 2021 16:50:51 +0200 Subject: [PATCH] Related: #1953669 - fix false positives in the upstrem test-suite --- coreutils-8.32-tests-false-positives.patch | 99 ++++++++++++++++++++++ coreutils.spec | 3 + 2 files changed, 102 insertions(+) create mode 100644 coreutils-8.32-tests-false-positives.patch diff --git a/coreutils-8.32-tests-false-positives.patch b/coreutils-8.32-tests-false-positives.patch new file mode 100644 index 0000000..0b0a301 --- /dev/null +++ b/coreutils-8.32-tests-false-positives.patch @@ -0,0 +1,99 @@ +From fc6318841f008dadc1e7c93e539f10d24aa83e90 Mon Sep 17 00:00:00 2001 +From: Bernhard Voelker +Date: Wed, 21 Apr 2021 00:12:00 +0200 +Subject: [PATCH 1/2] tests: fix FP in ls/stat-free-color.sh + +On newer systems like Fedora 34 and openSUSE Tumbleweed, ls(1) calls +newfstatat(STDOUT_FILENO, ...), but only when there is something to +output. + +* tests/ls/stat-free-color.sh: Add -a option to the reference invocation +of ls, thus enforcing something gets output. + +Upstream-commit: b7091093bb6505c33279f9bc940b2e94763a6e5d +Signed-off-by: Kamil Dudka +--- + tests/ls/stat-free-color.sh | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/tests/ls/stat-free-color.sh b/tests/ls/stat-free-color.sh +index 00942f7..87bed1c 100755 +--- a/tests/ls/stat-free-color.sh ++++ b/tests/ls/stat-free-color.sh +@@ -56,12 +56,14 @@ eval $(dircolors -b color-without-stat) + # The system may perform additional stat-like calls before main. + # Furthermore, underlying library functions may also implicitly + # add an extra stat call, e.g. opendir since glibc-2.21-360-g46f894d. +-# To avoid counting those, first get a baseline count for running +-# ls with one empty directory argument. Then, compare that with the +-# invocation under test. ++# Finally, ls(1) makes a stat call for stdout, but only in the case ++# when there is something to output. ++# To get the comparison right, first get a baseline count for running ++# 'ls -a' with one empty directory argument. Then, compare that with ++# the invocation under test. + mkdir d || framework_failure_ + +-strace -q -o log1 -e $stats ls --color=always d || fail=1 ++strace -q -o log1 -e $stats ls -a --color=always d || fail=1 + n_stat1=$(grep -vF '+++' log1 | wc -l) || framework_failure_ + + test $n_stat1 = 0 \ +-- +2.31.1 + + +From c16ca58f17a088e925c0d1c4015c48332c380a00 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Sun, 9 May 2021 23:41:00 +0100 +Subject: [PATCH 2/2] tests: fix tests/cp/sparse-2.sh false failure on some + systems + +* tests/cp/sparse-2.sh: Double check cp --sparse=always, +with dd conv=sparse, in the case where the former didn't +create a sparse file. Now that this test is being newly run +on macos, we're seeing a failure due to seek() not creating +holes on apfs unless the size is >= 16MiB. + +Upstream-commit: 6b499720fecae935dc00e236d6aefe94d9010482 +Signed-off-by: Kamil Dudka +--- + tests/cp/fiemap-2.sh | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/tests/cp/fiemap-2.sh b/tests/cp/fiemap-2.sh +index 548a376..e20ce54 100755 +--- a/tests/cp/fiemap-2.sh ++++ b/tests/cp/fiemap-2.sh +@@ -17,7 +17,7 @@ + # along with this program. If not, see . + + . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +-print_ver_ cp ++print_ver_ cp stat dd + + # Require a fiemap-enabled FS. + touch fiemap_chk # check a file rather than current dir for best coverage +@@ -46,10 +46,17 @@ dd bs=1k seek=1 of=k count=255 < /dev/zero || framework_failure_ + + # cp should detect the all-zero blocks and convert some of them to holes. + # How many it detects/converts currently depends on io_blksize. +-# Currently, on my F14/ext4 desktop, this K starts off with size 256KiB, ++# Currently, on my F14/ext4 desktop, this K file starts off with size 256KiB, + # (note that the K in the preceding test starts off with size 4KiB). + # cp from coreutils-8.9 with --sparse=always reduces the size to 32KiB. + cp --sparse=always k k2 || fail=1 +-test $(stat -c %b k2) -lt $(stat -c %b k) || fail=1 ++if test $(stat -c %b k2) -ge $(stat -c %b k); then ++ # If not sparse, then double check by creating with dd ++ # as we're not guaranteed that seek will create a hole. ++ # apfs on darwin 19.2.0 for example was seen to not to create holes < 16MiB. ++ hole_size=$(stat -c %o k2) || framework_failure_ ++ dd if=k of=k2.dd bs=$hole_size conv=sparse || framework_failure_ ++ test $(stat -c %b k2) -eq $(stat -c %b k2.dd) || fail=1 ++fi + + Exit $fail +-- +2.31.1 + diff --git a/coreutils.spec b/coreutils.spec index 806886b..a474cdf 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -52,6 +52,9 @@ Patch12: coreutils-8.32-mem-leaks.patch # utimens: fix confusing arg type in internal func Patch13: coreutils-8.32-coverity-utimens.patch +# fix false positives in the upstrem test-suite (#1960792) +Patch14: coreutils-8.32-tests-false-positives.patch + # disable the test-lock gnulib test prone to deadlock Patch100: coreutils-8.26-test-lock.patch