zsh-workers
 help / color / mirror / code / Atom feed
* glob qualifier '-' doesn't work correctly on dangling symlinks
@ 2020-04-11 15:15 Vincent Lefevre
  2020-04-11 17:34 ` Stephane Chazelas
  0 siblings, 1 reply; 24+ messages in thread
From: Vincent Lefevre @ 2020-04-11 15:15 UTC (permalink / raw)
  To: zsh-workers

The glob qualifier '-' doesn't work correctly on dangling symlinks.

I had reported the following bug in Debian in 2008:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510038

where I said:

For instance:

$ zsh <<EOF
set -ex
echo $ZSH_VERSION
mkdir globtest-dir
cd globtest-dir
touch file1
chmod 644 file1
ln -s file1 file2
ln -s file0 file3
ls -l file*
ls -l file*(-W)
EOF

gives:

+zsh:2> echo 4.3.6
4.3.6
+zsh:3> mkdir globtest-dir
+mkdir:0> mkdir globtest-dir
+zsh:4> cd globtest-dir
+zsh:5> touch file1
+zsh:6> chmod 644 file1
+zsh:7> ln -s file1 file2
+ln:0> ln -s file1 file2
+zsh:8> ln -s file0 file3
+ln:0> ln -s file0 file3
+zsh:9> ls -l file1 file2 file3
-rw-r--r-- 1 lefevre lefevre 0 2008-12-28 22:34:28 file1
lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file2 -> file1
lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0
+zsh:10> ls -l file3
lrwxrwxrwx 1 lefevre lefevre 5 2008-12-28 22:34:28 file3 -> file0

file*(-W) should have no matches.

(note that Mac OS X was not affected at that time).

This still occurs in zsh 5.8.

I've looked at the code, and it seems that zsh ignores stat errors
(such as ENOENT) in this case, which is bad.

However, "echo file0(W)" is handled correctly.

zira% echo file0(W)
zsh: no matches found: file0(W)

Thus the issue concerns only the glob qualifier '-' on symbolic links.

-- 
Vincent Lefèvre <vincent@vinc17.net> - 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)

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-04-15  9:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-11 15:15 glob qualifier '-' doesn't work correctly on dangling symlinks 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
2020-04-12 14:31     ` Vincent Lefevre
2020-04-12 15:49       ` Peter Stephenson
2020-04-12 23:07         ` Vincent Lefevre

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