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 24234 invoked from network); 12 Apr 2020 23:39:25 -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; 12 Apr 2020 23:39:25 -0000 Received: (qmail 8171 invoked by alias); 12 Apr 2020 23:39:20 -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: 45687 Received: (qmail 21110 invoked by uid 1010); 12 Apr 2020 23:39:20 -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/25779. spamassassin: 3.4.4. Clear:RC:0(155.133.131.76):SA:0(-1.9/5.0):. Processed in 0.748468 secs); 12 Apr 2020 23:39:20 -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: Mon, 13 Apr 2020 01:38:45 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: glob qualifier '-' doesn't work correctly on dangling symlinks Message-ID: <20200412233845.GB1831017@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20200411151511.GA1708902@zira.vinc17.org> <20200411173450.56nnznxtmil5oge3@chazelas.org> <20200411191711.GA1722320@zira.vinc17.org> <20200411203714.wupg6wmd7b7xch2w@chazelas.org> <20200411234817.GA1737986@zira.vinc17.org> <20200412012155.7954a35f@tarpaulin.shahaf.local2> <20200412021722.GA1748686@zira.vinc17.org> <20200412070930.etfzj6j2qvd5em7b@chazelas.org> <20200412142544.GA1783815@zira.vinc17.org> <20200412173448.rl3wttigdx5t5wcn@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200412173448.rl3wttigdx5t5wcn@chazelas.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.12.1+33 (6a74e24e) vl-117499 (2019-06-23) On 2020-04-12 18:34:48 +0100, Stephane Chazelas wrote: > 2020-04-12 16:25:44 +0200, Vincent Lefevre: > [...] > > > by the link, and not the link itself. If the > > > ^^^^^^ > > > referenced file does not exist, the file information > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > and type shall be for the link itself. > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > At least, that's explicit, unambiguous documentation. > [...] > > Well, as seen in the varying interpretations made by the various > implementations, it is not that clear. How do you determine > whether a file exists or not? What does "exist" mean? You necessarily know it, or that's an error case (permission denied or whatever). The behavior may not be clear in case of error, but one can expect at least a non-zero exit status: EXIT STATUS The following exit values shall be returned: 0 All path operands were traversed successfully. >0 An error occurred. As a comparison, for "test -e" https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html POSIX does not say "true if file exists" but conditions the result to the pathname resolution, so that the result is false if any error occurs, even if the file actually exists: -e pathname True if pathname resolves to an existing directory entry. False if pathname cannot be resolved. BTW, I don't know how zsh behaves on "[[ -e pathname ]]" in case of error other than ENOENT in the pathname resolution, but this should be documented (and ditto for the other conditional expressions). -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)