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

Re: Unreadable directories aren't included in glob expansion



[re-post to zsh-users. Sorry I read my MLs on gmane and always
forget that zsh-users and zsh-workers are cross-posted]

2020-01-09 15:51:41 +0000, Peter Stephenson:
> On Thu, 2020-01-09 at 15:41 +0000, Daniel Shahaf wrote:
> > Consider:
> > 
> > % mkdir foo
> > % mkdir -m 000 bar 
> > % echo */ 
> > foo/
> > % echo *(/)
> > bar foo
> > % 
> > 
> > Shouldn't the expansion of «*/» include «bar/»?
> 
> Certainly, */ and *(/) have always been inconsistent and I don't know of
> any fundamental reason why that needs to be.
[...]

*/ in all shells also includes symlinks to directories. So if
only for that reason, it has to be different from *(/).

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).

It might make it the only  POSIX compliant shell as I have a
vague recollection it's meant to give the same result as */.,
but that could very  well be a bad recollection, and if that was
a POSIX requirement, that's probably one that should change.

IMO, */ should give the same list as *(-/) (with some /
appended), that is expand to the files that can be determined to
be of type "directory" after symlink resolution (determined from
the result of stat(), not lstat()) for consistency with other
shells.

-- 
Stephane



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