From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory Date: Sat, 17 Dec 2022 14:40:09 -0800 Message-ID: <7c209ab7-056b-8300-09b9-87549f6084be@cs.ucla.edu> References: <87y1sws6eq.fsf@posteo.net> <83wn8gdu4k.fsf@gnu.org> <31dc6bb7-ada3-aeac-c65b-d7de4a326026@cs.ucla.edu> <87k04ebhvn.fsf@gmx.de> <83zgbutdz5.fsf@gnu.org> <83h6xuihgc.fsf@gnu.org> <87y1r69x2e.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------OVTjdLYEpbUDkglMTqbsUGdZ" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13044"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: thievol@posteo.net, 58919-done@debbugs.gnu.org To: Michael Albinus , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 17 23:41:41 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p6fsA-00038j-58 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Dec 2022 23:41:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6frf-0007We-Hm; Sat, 17 Dec 2022 17:41:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6frb-0007W2-31 for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:41:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6fra-0003xl-Qv for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p6fra-0002ft-8z for bug-gnu-emacs@gnu.org; Sat, 17 Dec 2022 17:41:02 -0500 Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 22:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 58919 X-GNU-PR-Package: emacs Mail-Followup-To: 58919@debbugs.gnu.org, eggert@cs.ucla.edu, thievol@posteo.net Original-Received: via spool by 58919-done@debbugs.gnu.org id=D58919.167131682010257 (code D ref 58919); Sat, 17 Dec 2022 22:41:02 +0000 Original-Received: (at 58919-done) by debbugs.gnu.org; 17 Dec 2022 22:40:20 +0000 Original-Received: from localhost ([127.0.0.1]:58368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fqu-0002fN-4J for submit@debbugs.gnu.org; Sat, 17 Dec 2022 17:40:20 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:34416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6fqs-0002fE-AH for 58919-done@debbugs.gnu.org; Sat, 17 Dec 2022 17:40:18 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 06816160066; Sat, 17 Dec 2022 14:40:12 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id I8l3joNOxwL0; Sat, 17 Dec 2022 14:40:10 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 916E0160092; Sat, 17 Dec 2022 14:40:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra.cs.ucla.edu 916E0160092 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=78364E5A-2AF3-11ED-87FA-8298ECA2D365; t=1671316810; bh=WOwQJDjWj5ua15XSyQAYac+Sxf2zODTf5cz16HguMlA=; h=Content-Type:Message-ID:Date:MIME-Version:Subject:To:From; b=FFkiOPwvQaGCUp9Jv4fQ3UAIRmjMhZuRAQLdiANfa3mmBgveGGITdMq1GMFiOn2ty wZ7wNXeeTNlmp+AhcntLKD/vbkdNWUMHmWZ0lXnAZ6fweKN5kg/SilvXuUknSgVNVV jV+zI8eGUROCqRDtQvI90j0yJp0IokVYNBBupkvw= X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5pQY4-5QZFKe; Sat, 17 Dec 2022 14:40:10 -0800 (PST) Original-Received: from [192.168.86.236] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1E4DC160066; Sat, 17 Dec 2022 14:40:10 -0800 (PST) Content-Language: en-US In-Reply-To: <87y1r69x2e.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251316 Archived-At: This is a multi-part message in MIME format. --------------OVTjdLYEpbUDkglMTqbsUGdZ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------OVTjdLYEpbUDkglMTqbsUGdZ Content-Type: text/x-patch; charset=UTF-8; name="0001-Don-t-assume-make-directory-handler-returns-nil.patch" Content-Disposition: attachment; filename*0="0001-Don-t-assume-make-directory-handler-returns-nil.patch" Content-Transfer-Encoding: base64 RnJvbSA0YThmZjY3MWIwZTkzZTk2ZjdmY2E0MjA0Y2RiYzgzZjk5YTMzODdjIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTYXQsIDE3IERlYyAyMDIyIDE0OjA5OjAzIC0wODAwClN1YmplY3Q6IFtQQVRD SF0gPT9VVEYtOD9xP0Rvbj1FMj04MD05OXQ9MjBhc3N1bWU9MjBtYWtlLWRpcmVjdG9yeT0y MGhhbmRsPz0KID0/VVRGLTg/cT9lcj0yMHJldHVybnM9MjBuaWw/PQpNSU1FLVZlcnNpb246 IDEuMApDb250ZW50LVR5cGU6IHRleHQvcGxhaW47IGNoYXJzZXQ9VVRGLTgKQ29udGVudC1U cmFuc2Zlci1FbmNvZGluZzogOGJpdAoKKiBsaXNwL2ZpbGVzLmVsIChtYWtlLWRpcmVjdG9y eSk6IElnbm9yZSB3aGF0IHRoZSBtYWtlLWRpcmVjdG9yeQpoYW5kbGVyIHJldHVybnMsIGFz IGl0cyByZXR1cm4gdmFsdWUgd2FzIG5vdCBkb2N1bWVudGVkIGluIEVtYWNzIDI4LgotLS0K IGxpc3AvZmlsZXMuZWwgfCA3ICsrKysrKy0KIDEgZmlsZSBjaGFuZ2VkLCA2IGluc2VydGlv bnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9saXNwL2ZpbGVzLmVsIGIvbGlz cC9maWxlcy5lbAppbmRleCAzY2Y3ODMzYWUwMi4uY2M3ZDdlMmFmOTQgMTAwNjQ0Ci0tLSBh L2xpc3AvZmlsZXMuZWwKKysrIGIvbGlzcC9maWxlcy5lbApAQCAtNjIyNCw3ICs2MjI0LDEy IEBAIG1ha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