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: Michael Albinus
Subject: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory
Date: Sun, 18 Dec 2022 20:35:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Paul Eggert <eggert@cs.ucla.edu> writes:

Hi Paul,

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

Hmm, you're right. I re-read your make-directory code, it looks like
PARENTS isn't propagated any longer to the file name handlers. So this
must be handled documented there, at least.

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

Yep. Using the return value of the handlers shall be re-enabled in Emacs 30.

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

Yes, I will adapt the Tramp and ange-ftp handlers accordingly. Since the
return value is either undocumented, or (in Emacs 29) suppressed,
there's no harm.

For the time being, I have applied a small patch fixing an issue from
your last tramp-smb.el change.

Best regards, Michael.





reply via email to

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