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

Re: glob qualifier '-' doesn't work correctly on dangling symlinks

On 2020-04-12 01:21:55 +0000, Daniel Shahaf wrote:
> To be explicit, then, the proposal is that «brokensymlink(-W)» and
> «brokensymlink(-^W)» should both trigger the "no match" error?  (I.e.,
> the target of a broken symlink is neither writable nor not writable.)


> What should «brokensymlink(-)» do?

Since no filtering is requested on the non-existing target of
the symlink, this could give "brokensymlink", i.e. ignore the
fact that "-" was used.

However, one could decide that the use of "-" will immediately
filter out broken symlinks.

> What would be the glob qualifier syntax for broken symlinks?

There would need something for that. But even currently, there
are things one cannot do with glob qualifiers, such as one does
not have a way to know the reason why a symlink is broken, which
can be important when one is interested in broken symlinks.

zira% ln -s /does-not-exist s1
zira% ln -s /root/foo s2
zira% ls -L s*
ls: cannot access 's1': No such file or directory
ls: cannot access 's2': Permission denied

But with glob qualifiers, there does not seem to be a way to
distinguish these two cases.

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

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