From 62ad661a5c6d30464d190777c360bb8a336004c6 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 6 Aug 2023 17:42:06 -0700 Subject: [PATCH] Add some more builtin path tests This plugs some holes in our tests. --- tests/checks/path.fish | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/checks/path.fish b/tests/checks/path.fish index 1e3b0377e..0e36f35d1 100644 --- a/tests/checks/path.fish +++ b/tests/checks/path.fish @@ -117,6 +117,69 @@ path filter --type file,dir --perm exec,write bin/fish . # So it passes. # CHECK: . +mkdir -p sbin +touch sbin/setuid-exe sbin/setgid-exe +chmod u+s,a+x sbin/setuid-exe +chmod g+s,a+x sbin/setgid-exe +path filter --perm suid sbin/* +# CHECK: sbin/setuid-exe +path filter --perm sgid sbin/* +# CHECK: sbin/setgid-exe + +mkdir stuff +touch stuff/{read,write,exec,readwrite,readexec,writeexec,all,none} +chmod 400 stuff/read +chmod 200 stuff/write +chmod 100 stuff/exec +chmod 600 stuff/readwrite +chmod 500 stuff/readexec +chmod 300 stuff/writeexec +chmod 700 stuff/all +chmod 000 stuff/none + +path filter --perm read stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/read +# CHECK: stuff/readexec +# CHECK: stuff/readwrite + +path filter --perm write stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/readwrite +# CHECK: stuff/write +# CHECK: stuff/writeexec + +path filter --perm exec stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/exec +# CHECK: stuff/readexec +# CHECK: stuff/writeexec + +path filter --perm read,write stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/readwrite + +path filter --perm read,exec stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/readexec + +path filter --perm write,exec stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/writeexec + +path filter --perm read,write,exec stuff/* | path sort +# CHECK: stuff/all + +path filter stuff/* | path sort +# CHECK: stuff/all +# CHECK: stuff/exec +# CHECK: stuff/none +# CHECK: stuff/read +# CHECK: stuff/readexec +# CHECK: stuff/readwrite +# CHECK: stuff/write +# CHECK: stuff/writeexec + path normalize /usr/bin//../../etc/fish # The "//" is squashed and the ".." components neutralize the components before # CHECK: /etc/fish