From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 7175 invoked from network); 11 Apr 2020 15:16:10 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 11 Apr 2020 15:16:10 -0000 Received: (qmail 28299 invoked by alias); 11 Apr 2020 15:15:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45671 Received: (qmail 5739 invoked by uid 1010); 11 Apr 2020 15:15:57 -0000 X-Qmail-Scanner-Diagnostics: from joooj.vinc17.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25772. spamassassin: 3.4.4. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 3.793805 secs); 11 Apr 2020 15:15:57 -0000 X-Envelope-From: vincent@vinc17.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Sat, 11 Apr 2020 17:15:11 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: glob qualifier '-' doesn't work correctly on dangling symlinks Message-ID: <20200411151511.GA1708902@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.12.1+33 (6a74e24e) vl-117499 (2019-06-23) 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 < 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 - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)