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

Re: [PATCH] Ignore EACCES when doing non-pure globbing



On 1/13/21, Devin Hussey <husseydevin@xxxxxxxxx> wrote:
> We are already violating POSIX with our globbing:
>
> "If the pattern does not match any existing filenames or pathnames, the
> pattern string shall be left unchanged."
>
> Therefore, this:
>
> zsh:1: no matches found: /tmp/inaccessible/a/*
>
> is wrong, it should just print this:
>
> /tmp/inaccessible/a/*

If you want the broken POSIX behavior you can say 'setopt nonomatch'.

> Also, at least with the implementation on my device, the glob() function
> works fine as long as the folder has execute permission. (The sample was
> wrong, it should be 111, not 000)

This makes quite a big difference indeed. Have you considered just not
unsetting caseglob?
Also of note (maybe) (without unsetting caseglob obviously) (and
setting extendedglob),
% echo $PWD/(#i)a*
/tmp/inaccessible/a/A /tmp/inaccessible/a/a
% echo (#i)$PWD/a*
zsh: no matches found: (#i)/tmp/inaccessible/a/a*

Eg, as long as you don't ask for case insensitiveness for the
unreadable segments, you're fine.

-- 
Mikael Magnusson




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