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

Re: Unreadable directories aren't included in glob expansion



Stephane Chazelas wrote on Fri, Jan 10, 2020 at 07:27:53 +0000:
> 2020-01-09 17:22:22 +0000, Stephane Chazelas:
> [...]
> > Now, zsh seems to be the only shell where */ excludes the
> > non-*searchable* (it does include the non-readable ones provided
> > you have search access).
> [...]
> 
> And conversely, it doesn't include readable dirs if they are not
> searchable which can be even more surprising:
> 
> $ ls -l
> total 2
> drwxrwxr-x 2 chazelas chazelas 2 Jan  9 17:07 1/
> dr--r--r-- 2 chazelas chazelas 3 Jan  9 17:17 2/
> drwxrwxr-x 2 chazelas chazelas 2 Jan  9 17:07 3/
> $ echo */
> 1/ 3/
> $ echo */*
> 2/file

Thanks, here's an updated test:

diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 5638e1255..22c663260 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -728,3 +728,16 @@
 >does/not/exist
 >not/exist
 >exist
+
+ 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-*(-/)
+-f: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
+>glob.tmp/secret-s000/  glob.tmp/secret-s000
+>glob.tmp/secret-s111/  glob.tmp/secret-s111
+>glob.tmp/secret-s444/  glob.tmp/secret-s444

It passes if the mkdir's are done with the default permissions.



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