On 24/03/2024 16:30, Bruno Haible wrote:
The ls/removed-directory test fails on FreeBSD 14.0.

tests-suite.log from FreeBSD 14.0:


FAIL: tests/ls/removed-directory
================================

diff -u /dev/null err
--- /dev/null   1970-01-01
+++ err 1970-01-01
+ls: reading directory '.': No such file or directory
FAIL tests/ls/removed-directory.sh (exit status: 1)

It seems that readdir() on FreeBSD 14 is _not_ eating the ENOENT from 
getdirentries().
Attached is an extra check for that, that avoids the test in that case.

An alternative would be for ls to ignore the ENOENT from readdir().
Paul what do you think?
From 0edfa7a07feeea5295f79e54ae6144d9ca2b8257 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Tue, 26 Mar 2024 16:44:12 +0000
Subject: [PATCH] tests: avoid a false failure with ls on FreeBSD 14

* tests/ls/removed-directory.sh: readdir() was seen _not_
to eat ENOENT from getdirentries() on FreeBSD 14.
I.e. ls will produce an error in this case, so skip the
test in that case.
Reported by Bruno Haible
---
 tests/ls/removed-directory.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
index 291d77ee3..8a9d47310 100755
--- a/tests/ls/removed-directory.sh
+++ b/tests/ls/removed-directory.sh
@@ -26,6 +26,13 @@ mkdir d || framework_failure_
 cd d || framework_failure_
 rmdir ../d || skip_ "can't remove working directory on this platform"
 
+# FreeBSD 14 was seen to _not_ eat the ENOENT in readdir()
+# so on non GNU Linux, verify first that readdir() doesn't error
+case $host_triplet in
+  *linux-gnu*) ;;  # Assume OK for better test coverage
+  *) python -c 'import os; os.listdir(".")' || skip_ 'readdir() fails' ;;
+esac
+
 # On NFS, 'ls' would run into the error "Stale file handle".
 test -d . || skip_ "can't examine removed working directory on this platform"
 
-- 
2.44.0

Reply via email to