]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix FP in ls/stat-free-color.sh
authorBernhard Voelker <mail@bernhard-voelker.de>
Tue, 20 Apr 2021 22:12:00 +0000 (00:12 +0200)
committerBernhard Voelker <mail@bernhard-voelker.de>
Thu, 22 Apr 2021 18:14:32 +0000 (20:14 +0200)
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.

tests/ls/stat-free-color.sh

index 13f41a0907316cff4aa6842f34fb9c04fba829d2..fac609f910fcd1acd56641798214819868c348f3 100755 (executable)
@@ -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 \