summary refs log tree commit diff
path: root/Test/D02glob.ztst
diff options
context:
space:
mode:
Diffstat (limited to 'Test/D02glob.ztst')
-rw-r--r--Test/D02glob.ztst27
1 files changed, 17 insertions, 10 deletions
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 973dc2207..4e6dc2a7a 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -729,16 +729,12 @@
 >not/exist
 >exist
 
- if [[ $OSTYPE = cygwin* ]]; then
-   ZTST_skip='Cygwin ignores search permission of directories'
- else
-   mkdir -m 000 glob.tmp/secret-d000
-   mkdir -m 111 glob.tmp/secret-d111
-   mkdir -m 444 glob.tmp/secret-d444
-   for 1 in 000 111 444 ; do ln -s secret-d$1 glob.tmp/secret-s$1; done
-   print -rC 2 -- glob.tmp/secret-*/ glob.tmp/secret-*(-/)
- fi
--f:unreadable directories can be globbed (users/24619, users/24626)
+ mkdir -m 000 glob.tmp/secret-d000
+ mkdir -m 111 glob.tmp/secret-d111
+ mkdir -m 444 glob.tmp/secret-d444
+ for 1 in 000 111 444 ; do ln -s secret-d$1 glob.tmp/secret-s$1; done
+ print -rC 2 -- glob.tmp/secret-*/ glob.tmp/secret-*(-/)
+0:unreadable directories can be globbed (users/24619, users/24626)
 >glob.tmp/secret-d000/  glob.tmp/secret-d000
 >glob.tmp/secret-d111/  glob.tmp/secret-d111
 >glob.tmp/secret-d444/  glob.tmp/secret-d444
@@ -746,6 +742,17 @@
 >glob.tmp/secret-s111/  glob.tmp/secret-s111
 >glob.tmp/secret-s444/  glob.tmp/secret-s444
 
+ # On macOS, stat(2) allows files to be treated as directories if the calling
+ # process has super-user privileges. e.g., stat() on /my/regular/file/. will
+ # succeed as root but (correctly) fail otherwise. This can produce strange
+ # results when globbing, depending on how it's implemented. This test should,
+ # when run with privileges, confirm that the implementation avoids this
+ # problem. See workers/42891 and workers/45291
+ : > glob.tmp/not-a-directory
+ print -r - glob.tmp/not-a-dir*(N) , glob.tmp/not-a-dir*/(N)
+0:non-directories not globbed as directories
+>glob.tmp/not-a-directory ,
+
  () { echo $1:P } ////dev
 -f:(workers/45367) modifier ':P' squashes multiple slashes
 >/dev