]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: stat-vs-dirent.sh: avoid a false failure
authorPádraig Brady <P@draigBrady.com>
Sun, 12 Sep 2021 17:53:40 +0000 (18:53 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 12 Sep 2021 22:16:18 +0000 (23:16 +0100)
* tests/ls/stat-vs-dirent.sh: Skip the test if we can't stat(1),
as the file may have been removed, or have a malformed name
due to '\n' etc. in the file name.

tests/ls/stat-vs-dirent.sh

index 4be4fadd1fb7006faba2d02e0ba43681565c64cf..d50ed6a67f323dd0f32ebdbbc250fd96ddc23007 100755 (executable)
@@ -32,7 +32,8 @@ while :; do
     file=$(sed -n '1s/^ *[0-9][0-9]* //p;q' tmp)
 
     # Get its inode number (stat.st_ino) via stat(1)'s call to lstat.
-    st_ino=$(stat --format=%i "$t/$file")
+    st_ino=$(stat --format=%i "$t/$file") ||
+        skip_ "error stating: $t/$file"  # removed or newlines in name etc.
 
     # Make sure that they are the same.
     # We know from experience that there may be mismatches on some