Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Tests for globbing below protected directories



Does this test look as expected?  Note there are trailing spaces on
the "print -raC 2" output, which surprised me but has nothing to do
with the test itself.

This doesn't test for the CASEGLOB issue last mentioned in workers/47832.

diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 176846d46..d3b2e9ec2 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -741,6 +741,23 @@
 >glob.tmp/secret-s111/  glob.tmp/secret-s111
 >glob.tmp/secret-s444/  glob.tmp/secret-s444

+ for 1 in 000 111 444 ; do
+  chmod 777 glob.tmp/secret-d$1
+  touch glob.tmp/secret-d$1/file
+  mkdir -m 777 glob.tmp/secret-d$1/dir
+  touch glob.tmp/secret-d$1/dir/file
+  chmod $1 glob.tmp/secret-d$1
+ done
+ print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+0:names inside unreadable directories can be globbed if searchable
+>glob.tmp/secret-d444/dir   glob.tmp/secret-d444/file
+>glob.tmp/secret-s444/dir   glob.tmp/secret-s444/file
+>glob.tmp/secret-d111/file  glob.tmp/secret-s111/file
+
+ print -rC 2 -- glob.tmp/secret-*/dir/*
+0:glob files in readable directories inside unreadable directories
+>glob.tmp/secret-d111/dir/file  glob.tmp/secret-s111/dir/file
+
  # 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




Messages sorted by: Reverse Date, Date, Thread, Author