From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: glob qualifier '-' doesn't work correctly on dangling symlinks
Date: Sun, 12 Apr 2020 13:48:43 +0100 [thread overview]
Message-ID: <b765592b89c3e63c3535f42f413c99c5f29de66f.camel@ntlworld.com> (raw)
In-Reply-To: <20200411173450.56nnznxtmil5oge3@chazelas.org>
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
On Sat, 2020-04-11 at 18:34 +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).
>
> The manual has:
>
> > ls -ld -- *(-@)
> >
> > lists all broken symbolic links, and
Yes, it's already implicit and useful that this is how it works; I use
it myself. We should document it better. The current form is ambiguous
--- "the file it refers to" is meaningless if it doesn't refer to a
file.
We certainly can't change this at this stage, but that wouldn't stop us
adding something with alternative behaviour.
For convenience, the proposed wording in the attached is
item(tt(-))(
toggles between making the qualifiers work on symbolic links (the
default) and the files they point to, if any; a broken symbolic link
is treated as a file in its own right
)
pws
[-- Attachment #2: broken_symlinks.dif --]
[-- Type: text/x-patch, Size: 486 bytes --]
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 2a66ab997..fd1f1ca3b 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -2837,7 +2837,8 @@ negates all qualifiers following it
)
item(tt(-))(
toggles between making the qualifiers work on symbolic links (the
-default) and the files they point to
+default) and the files they point to, if any; a broken symbolic link
+is treated as a file in its own right
)
item(tt(M))(
sets the tt(MARK_DIRS) option for the current pattern
next prev parent reply other threads:[~2020-04-12 12:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-11 15:15 Vincent Lefevre
2020-04-11 17:34 ` Stephane Chazelas
2020-04-11 19:17 ` Vincent Lefevre
2020-04-11 20:37 ` Stephane Chazelas
2020-04-11 23:48 ` Vincent Lefevre
2020-04-12 1:21 ` Daniel Shahaf
2020-04-12 2:17 ` Vincent Lefevre
2020-04-12 7:09 ` Stephane Chazelas
2020-04-12 14:25 ` Vincent Lefevre
2020-04-12 17:34 ` Stephane Chazelas
2020-04-12 23:38 ` Vincent Lefevre
2020-04-13 14:22 ` Stephane Chazelas
2020-04-13 15:00 ` Bart Schaefer
2020-04-13 21:41 ` Vincent Lefevre
2020-04-14 6:18 ` Stephane Chazelas
2020-04-14 12:02 ` Daniel Shahaf
2020-04-14 12:38 ` Stephane Chazelas
2020-04-15 0:44 ` Daniel Shahaf
2020-04-15 9:17 ` Vincent Lefevre
2020-04-14 17:59 ` Vincent Lefevre
2020-04-12 12:48 ` Peter Stephenson [this message]
2020-04-12 14:31 ` Vincent Lefevre
2020-04-12 15:49 ` Peter Stephenson
2020-04-12 23:07 ` Vincent Lefevre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b765592b89c3e63c3535f42f413c99c5f29de66f.camel@ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).