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-11 18:34:50 +0100, Stephane Chazelas wrote:
> 2020-04-11 17:15:11 +0200, Vincent Lefevre:
> [...]
> > +zsh:10> ls -l file3
> > lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
> > 
> > file*(-W) should have no matches.
> [...]
> 
> It is not really documented but kind of implied that on broken
> symlinks, after -, we're still looking at the symlink instead of
> the target (there's no target for us to look at anyway).

This is documented differently:

    -     toggles between making the qualifiers work on symbolic links
          (the default) and the files they point to

There isn't a different condition whether the target exists or not.

> The manual has:
> 
> >      ls -ld -- *(-@)
> > 
> > lists all broken symbolic links, and
> 
> That's consistent with GNU find's -xtype l

But the behavior is not consistent with the stat system call, with
the GNU stat utility (when using the --dereference option), and with
zsh/stat.

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