]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
ls: add test case for ls -Z bug
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Nov 2024 00:51:02 +0000 (16:51 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 10 Nov 2024 00:51:26 +0000 (16:51 -0800)
Problem reported by Pádraig Brady <https://bugs.gnu.org/73418#35>.
This bug was fixed by the recent gnulib update.
* tests/ls/selinux-segfault.sh:
Also test for ls -Z on broken symlinks.

tests/ls/selinux-segfault.sh

index ebcfbfe13634bcc192ffd4553e4f7faad2714044..9ac1d950ce5fee32057884643200b5986de35ac9 100755 (executable)
@@ -30,4 +30,19 @@ mkdir sedir || framework_failure_
 ln -sf missing sedir/broken || framework_failure_
 returns_ 1 ls -L -R -Z -m sedir > out || fail=1
 
+nl='
+'
+if sestatus=$(LC_ALL=C sestatus); then
+  sestatus_line_1=${sestatus%%$nl*}
+  case $sestatus_line_1 in
+    'SELinux status:'*' enabled')
+      ls_output=$(LC_ALL=C ls -lnZ sedir/broken) || fail=1
+      set x $ls_output
+      case $6 in
+        *:*:*:*) ;;
+        *) fail=1;
+      esac
+  esac
+fi
+
 Exit $fail