From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory Date: Mon, 31 Oct 2022 15:01:47 +0200 Message-ID: <83wn8gdu4k.fsf@gnu.org> References: <87y1sws6eq.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6913"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58919@debbugs.gnu.org To: Thierry Volpiatto , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 14:14:34 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 1opUcb-0001eS-Qf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 14:14:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opURY-0006m9-83; Mon, 31 Oct 2022 09:03:08 -0400 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 1opURS-0006fB-Lm for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 09:03:02 -0400 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 1opURS-0006dD-BF for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 09:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opURR-0005Jt-Rc for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 09:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 13:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58919 X-GNU-PR-Package: emacs Original-Received: via spool by 58919-submit@debbugs.gnu.org id=B58919.166722134820348 (code B ref 58919); Mon, 31 Oct 2022 13:03:01 +0000 Original-Received: (at 58919) by debbugs.gnu.org; 31 Oct 2022 13:02:28 +0000 Original-Received: from localhost ([127.0.0.1]:39738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUQt-0005I6-Mb for submit@debbugs.gnu.org; Mon, 31 Oct 2022 09:02:28 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUQn-0005Hm-KV; Mon, 31 Oct 2022 09:02:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUQg-0006PY-Ka; Mon, 31 Oct 2022 09:02:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ktCnJJZxVIvxSPqCujvMQHBc2aygj1RNq7IdojRPMkU=; b=THNVBceqqPd9 zkuJYzndNAE/91ak3FiUF/pw28IUFkpjZIPeZDcRu8RJEQYY//nqdfJWvpzttqwNRPeTThTsEqf5/ OBh8cxxugVgvCgLykSSi75GhLdCIR5lwCsmkciF4LJXTPJeERHlx3q1/Oimu49GBMkYqxS9Ru5S6V ehpq4azFgtFuO94ZizpwzIcerFTmqxkz1YsXSTjm4kT4YetgAcVzw1wpoHhXn9bGo+/0g8zAV/J7s X0oML5XBS2YuPA/fTqIhVlbYPF3QVKxH6P4B90Tdt1pzaF/c7werUu4R/WkghIrI2N77hZ4uGlPnX AddwQdk6VSs0Dbas7x1uIg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUQV-00080X-Lg; Mon, 31 Oct 2022 09:02:13 -0400 In-Reply-To: <87y1sws6eq.fsf@posteo.net> (message from Thierry Volpiatto on Mon, 31 Oct 2022 08:54:28 +0000) 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246680 Archived-At: merge 58919 58918 thanks > From: Thierry Volpiatto > Date: Mon, 31 Oct 2022 08:54:28 +0000 > > > This is a followup of this report on reddit: > https://www.reddit.com/r/emacs/comments/yha104/merging_directories_in_dired_am_i_doing_it_wrong/ Which was already reported as bug#58918... > When using dired-copy to copy a directory to another directory > containing a directory with the same name overwriting fails. > e.g. copy ~/tmp/test/foo/ to ~/tmp/test1/ fails when test1 contain foo/ > > The bug is IMHO in copy-directory 3th clause of this cond: > > (cond ((not (directory-name-p newname)) > ;; If NEWNAME is not a directory name, create it; > ;; that is where we will copy the files of DIRECTORY. > (make-directory newname parents)) > ;; NEWNAME is a directory name. If COPY-CONTENTS is non-nil, > ;; create NEWNAME if it is not already a directory; > ;; otherwise, create NEWNAME/[DIRECTORY-BASENAME]. > ((if copy-contents > (or parents (not (file-directory-p newname))) > (setq newname (concat newname > (file-name-nondirectory directory)))) > (make-directory (directory-file-name newname) parents)) > (t (setq follow t))) > > This change was introduced here: > > commit 047f02f00f602b9aef63ae8938e12f3f0ab481eb > Author: Paul Eggert > Date: Wed Sep 20 11:49:12 2017 -0700 > > Fix new copy-directory bug with empty dirs > > Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii > (Bug#28483#34). This is another bug that I introduced in my > recent copy-directory changes. > * lisp/files.el (copy-directory): Work with empty subdirectories, too. > * test/lisp/files-tests.el (files-tests--copy-directory): > Test for this bug. > > Reverting this change fix the bug. Paul, could you please look into this? I think this also affects bug#58721. Thanks.