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

Re: PATCH: misc glob fixes



Zefram wrote:
> Zoltan Hidvegi wrote:
> >First, many systems ignore trailing slashes on filenames.  As a result */
> >will match all files instead of just directories as required by common
> >sense and the POSIX standard.  The solution is to stat/lstat/access
> >`filename/.' instead of `filename/'.
> 
> But "filename/." can't be statted if the directory is not searchable
> by the zsh process, whereas POSIX would require the glob to succeed.
> It would be better to stat "filename/" and test that the result has
> type directory.

Actually I'm not sure about that.  POSIX requites that pathname
components other than the last component should be searchable.  You
can think filename/ as two components, the second component is empty.

I tested many shells (various old Korn and Bourne shells) and none of
them matches unsearchable directories with */

Also note that on Linux you need search permission on filename in
order to stat filename/, so on Linux sometimes you are not allowed to
stat filename/ while you are allowed to stat filename.  The same is
true for the good old Ultrix 4.2, and perhaps other systems.  On these
systems the patch has no effect on the shell behavior.  I think the
shell should behave the same way on all systems, and it should behave
like sh and ksh, so I think that the patch implements the correct
behavior.

Zoli



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