emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improve reporting of I/O, access errors for Emacs


From: Paul Eggert
Subject: Re: Improve reporting of I/O, access errors for Emacs
Date: Thu, 12 Sep 2019 13:32:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 9/12/19 12:34 PM, Eli Zaretskii wrote:
We should just set
errno and return an error indication, and then let the caller deal
with that.

I don't see how that could work. Callers are typically written in Lisp, and so can't see errno.

For example, suppose Lisp code calls (file-symlink-p "/a/b/c") and Emacs cannot tell whether /a/b/c is a symbolic link because of an I/O error, or because of a timeout in network access, or because /a is a symlink into an unreadable directory, or whatever. If file-symlink-p merely returns nil, there's no way for the Lisp code to know that there was an exceptional situation and the Lisp code will continue based on the incorrect assumption that /a/b/c was not a symlink.

Instead of signaling these exceptional conditions, we could extend each primitive with a new optional argument saying what to do on failure. For example, (file-symlink-p "/a/b/c" t) could signal an exception or return a special value for these exceptional cases, whereas (file-symlink-p "/a/b/c" nil) would simply return nil. However, such an extension would require changes to Lisp code if it is intended to be reliable, and most Lisp code would not be changed and would continue to be unreliable in these exceptional situations. In contrast, the proposed patch means existing Lisp code will gain reliability without needing to be changed.

That's too small a sample, so it doesn't prove much in my book, sorry.

I've looked at and experimented with a reasonable amount of Elisp code, and haven't run into problems with the proposed patch. What's your contrary intuition based on? Can you give a realistic example of the problems you see from the patch?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]