bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory


From: Paul Eggert
Subject: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory
Date: Sat, 17 Dec 2022 14:40:09 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 12/17/22 01:52, Michael Albinus wrote:
Since file name handlers still raise an error in case DIR exists and
PARENTS is nil, we might see surprises in code assuming the new
behavior. I guess I'll add a change in tramp-*-handle-make-directory
like

--8<---------------cut here---------------start------------->8---
     (if (and (null parents) (file-exists-p dir))
        (if (>= emacs-major-version 29)
             t
          (tramp-error v 'file-already-exists dir)))
--8<---------------cut here---------------end--------------->8---

That doesn't look right, as there is no change as to whether make-directory signals an error. Nor is there any change in behavior when PARENTS is nil. The only change in behavior is when PARENTS is non-nil and DIRECTORY already exists as a directory: in this case, Emacs 29 returns non-nil whereas earlier Emacs returns (undocumented) nil.

So I think all that it would be nice to do is make sure the handlers ordinarily return nil, except that they return non-nil in the abovementioned special case. If a handler currently signals an error, it should continue to do so in the same way as it did before. Strictly speaking, modifying the handlers in this way won't affect whether they are compatible with Emacs 28- (since their return value is undocumented there) nor will it affect whether they work in Emacs 29 (since Emacs 29 ignores their return value). But it might affect whether the handlers will work with Emacs 30, which might start assuming the Emacs 29 API for make-directory handlers.

Come to think of it, if an existing make-directory handler returns non-nil now (which it is allowed to in Emacs 28 as the return value is undocumented), then the proposed changes would sometimes have caused make-directory to return that non-nil value to its caller, even when the Emacs 29 doc says make-directory should return nil. As far as I know no such make-directory handler does so now, but to be safe I installed the attached additional patch to make sure Emacss 29 make-directory returns nil in this situation. As the combined set of patches should fix the original bug report I'm marking it as done.

In Emacs 30 we could remove this additional patch once we've fixed all the handlers, along with omitting some of the other code that supports calling Emacs 28-style handlers in Emacs 30 environments. Or we could leave it in; there's no rush, I imagine.

Attachment: 0001-Don-t-assume-make-directory-handler-returns-nil.patch
Description: Text Data


reply via email to

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