GNU bug report logs - #58918
28.2; Copying files in dired

Previous Next

Package: emacs;

Reported by: Skyler Mayfield <skyler544 <at> gmail.com>

Date: Mon, 31 Oct 2022 08:15:02 UTC

Severity: normal

Merged with 58919

Found in version 28.2

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #7 received at control <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thierry Volpiatto <thievol <at> posteo.net>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 58919 <at> debbugs.gnu.org
Subject: Re: bug#58919: 28.2;
 dired-copy-file-recursive fails to overwrite directory
Date: Mon, 31 Oct 2022 15:01:47 +0200
merge 58919 58918
thanks

> From: Thierry Volpiatto <thievol <at> posteo.net>
> 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 <eggert <at> cs.ucla.edu>
> 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.




This bug report was last modified 2 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.