]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure with inaccessible mount points
authorThomas Deutschmann <whissi@gentoo.org>
Tue, 7 Nov 2017 05:32:53 +0000 (21:32 -0800)
committerPádraig Brady <P@draigBrady.com>
Tue, 7 Nov 2017 05:34:40 +0000 (21:34 -0800)
* tests/ls/readdir-mountpoint-inode.sh: Skip the test
if any mount points are inaccessible by the current user.
Fixes https://bugs.gnu.org/29167
Reported at: https://bugs.gentoo.org/353164

tests/ls/readdir-mountpoint-inode.sh

index b4ca9e46ef27fd73b1c33163e0bfe5e59e6926eb..5270df079819fcb7bf4def03e8ab54e840b0fac7 100755 (executable)
@@ -55,7 +55,10 @@ inode_via_readdir()
   esac
   opts=$(ls_ignore_options "$base")
   parent_dir=$(dirname "$mount_point")
-  eval "ls -i $opts '$parent_dir'" | sed 's/ .*//'
+  ls_out=$(eval "ls -i $opts '$parent_dir'")
+  test $? -eq 0 || \
+    skip_ "'$parent_dir' is not readable for current user"
+  echo $ls_out | sed 's/ .*//'
 }
 
 while read dir; do