GNU bug report logs - #28520
26.0.50; Dired recursive copy of directory fails

Previous Next

Package: emacs;

Reported by: adam plaice <plaice.adam+lists <at> gmail.com>

Date: Tue, 19 Sep 2017 22:44:04 UTC

Severity: normal

Tags: confirmed, fixed

Merged with 28529

Found in version 26.0.50

Fixed in version 26.0.60

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28520 in the body.
You can then email your comments to 28520 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28520; Package emacs. (Tue, 19 Sep 2017 22:44:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to adam plaice <plaice.adam+lists <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 19 Sep 2017 22:44:04 GMT) Full text and rfc822 format available.

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

From: adam plaice <plaice.adam+lists <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Dired recursive copy of directory fails
Date: Tue, 19 Sep 2017 23:34:43 +0100
Copying a directory recursively, with dired ("C"), fails.

To reproduce:

mkdir test_dired_copy/a1/b -p
cd test_dired_copy
emacs -Q --eval '(dired ".")'

In dired, execute `dired-do-copy' (kbd "C") on the `a1' directory,
select `a2' (within the same parent directory) as the destination, and
answer `yes' to (`Recursive copies of ...?').

*Dired log* contains (in my specific case):


Copy ‘/home/adam/test_dired_copy/a1’ to ‘/home/adam/test_dired_copy/a2’ failed:
(file-already-exists File exists /home/adam/test_dired_copy/a2)

Copy failed for 1 of 1 file


The result is that the directory `a2' is created, but the subdirectory
`b' is not created within it. (For repeated testing, `a2' has to be
deleted each time.)



I think (though I'm not completely sure) that the problem can be
traced to copy-directory, since the following elisp fails as well:

(copy-directory "/home/adam/test_dired_copy/a1" "/home/adam/test_dired_copy/a2")

or equivalently (if already within the directory):

(copy-directory "a1" "a2")


The regression occurred in the commit range
52739ffe773eb403f58a6223b7ef64175df58dd7..e22794867d878d53675fcc91d2ef1ad2494a2ff2
(I have not had time to rebuild emacs sufficiently many times and
check which exact commit is responsible).

The bug is present in the heads of both the emacs-26
(4bef92e9e02d074de1d92e30dc5ef4dd62558c80) and master
(b1f83c10df7d1bbb16f4e13d18119ad4aa1a2137) branches.


Thank you,
Adam


In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-13 built on adam
Repository revision: 4bef92e9e02d074de1d92e30dc5ef4dd62558c80
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:    Ubuntu 16.04.3 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --with-modules --without-pop'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny cl-macs seq byte-opt
gv bytecomp byte-compile cconv format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils dired-aux cl-loaddefs cl-lib dired dired-loaddefs elec-pair
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 100826 7691)
 (symbols 48 20537 1)
 (miscs 40 52 193)
 (strings 32 28786 1222)
 (string-bytes 1 745696)
 (vectors 16 15163)
 (vector-slots 8 497313 9957)
 (floats 8 48 124)
 (intervals 56 824 11)
 (buffers 992 15)
 (heap 1024 24906 1131))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28520; Package emacs. (Wed, 20 Sep 2017 08:35:01 GMT) Full text and rfc822 format available.

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

From: Tino Calancha <tino.calancha <at> gmail.com>
To: adam plaice <plaice.adam+lists <at> gmail.com>
Cc: 28520 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#28520: 26.0.50; Dired recursive copy of directory fails
Date: Wed, 20 Sep 2017 17:33:49 +0900
adam plaice <plaice.adam+lists <at> gmail.com> writes:

> Copying a directory recursively, with dired ("C"), fails.
>
> To reproduce:
>
> mkdir test_dired_copy/a1/b -p
> cd test_dired_copy
> emacs -Q --eval '(dired ".")'
>
> In dired, execute `dired-do-copy' (kbd "C") on the `a1' directory,
> select `a2' (within the same parent directory) as the destination, and
> answer `yes' to (`Recursive copies of ...?').
>
> *Dired log* contains (in my specific case):
>
>
> Copy ‘/home/adam/test_dired_copy/a1’ to ‘/home/adam/test_dired_copy/a2’ failed:
> (file-already-exists File exists /home/adam/test_dired_copy/a2)
>
> Copy failed for 1 of 1 file
>
>
> The result is that the directory `a2' is created, but the subdirectory
> `b' is not created within it. (For repeated testing, `a2' has to be
> deleted each time.)
Thank you for the report.
It seems the bug started with commit:
Make copy-directory act like copy-file etc. (e22794867d8)




Added tag(s) confirmed. Request was from Tino Calancha <tino.calancha <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 20 Sep 2017 08:35:02 GMT) Full text and rfc822 format available.

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 20 Sep 2017 19:00:03 GMT) Full text and rfc822 format available.

Notification sent to adam plaice <plaice.adam+lists <at> gmail.com>:
bug acknowledged by developer. (Wed, 20 Sep 2017 19:00:04 GMT) Full text and rfc822 format available.

Message #15 received at 28520-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 28483 <at> debbugs.gnu.org, Adam Plaice <plaice.adam+lists <at> gmail.com>,
 28520-done <at> debbugs.gnu.org, aaronjensen <at> gmail.com,
 Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#28483: 26.0.50; copy-directory does not create directories
Date: Wed, 20 Sep 2017 11:59:37 -0700
[Message part 1 (text/plain, inline)]
On 09/20/2017 04:26 AM, Eli Zaretskii wrote:
> I think the problem is in this line:
>
> 	  (cond
> 	   ((eq filetype t)       ; Directory but not a symlink.
> 	    (copy-directory file newname keep-time parents)) <<<<<<<<<<<
>
> Instead of 'newname', there should be (file-name-as-directory newname)
> there.  I think.

Thanks for diagnosing the problem and for the fix. That fix should work, 
and I think we can improve on it slightly by using (copy-directory file 
target keep-time parents t), as this makes the cond branch more parallel 
with the other alternatives and avoids a call to file-name-as-directory. 
So I installed the attached patch into the emacs-26 branch to do that, 
and to add a test case for this bug. This patch should also fix 
Bug#28520 "Dired recursive copy of directory fails", so I'll CC: that 
bug report and boldly close it.

PS. Sorry, Adam, for misspelling your first name in the commit message. 
I'll try to remember to fix that when it spills out into the ChangeLog file.

[0001-Fix-new-copy-directory-bug-with-empty-dirs.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28520; Package emacs. (Wed, 20 Sep 2017 19:55:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 28483 <at> debbugs.gnu.org, plaice.adam+lists <at> gmail.com, 28520 <at> debbugs.gnu.org,
 aaronjensen <at> gmail.com, tino.calancha <at> gmail.com
Subject: Re: bug#28483: 26.0.50; copy-directory does not create directories
Date: Wed, 20 Sep 2017 22:54:26 +0300
> Cc: 28483 <at> debbugs.gnu.org, aaronjensen <at> gmail.com, 28520-done <at> debbugs.gnu.org,
>  Adam Plaice <plaice.adam+lists <at> gmail.com>,
>  Tino Calancha <tino.calancha <at> gmail.com>
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Wed, 20 Sep 2017 11:59:37 -0700
> 
> Thanks for diagnosing the problem and for the fix. That fix should work, 
> and I think we can improve on it slightly by using (copy-directory file 
> target keep-time parents t), as this makes the cond branch more parallel 
> with the other alternatives and avoids a call to file-name-as-directory. 
> So I installed the attached patch into the emacs-26 branch to do that, 
> and to add a test case for this bug.

Thanks, works for me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28520; Package emacs. (Wed, 20 Sep 2017 23:08:02 GMT) Full text and rfc822 format available.

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

From: Adam Plaice <plaiceadam <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 28520 <at> debbugs.gnu.org, tino.calancha <at> gmail.com
Subject: Re: bug#28483: 26.0.50; copy-directory does not create directories
Date: Thu, 21 Sep 2017 00:04:48 +0100
Thanks for the very fast fix. The commit indeed resolves the problem for me.

Adam

> PS. Sorry, Adam, for misspelling your first name in the commit message. I'll try to remember to fix that when it spills out into the ChangeLog file.

Don't worry about it!




Forcibly Merged 28520 28529. Request was from Tino Calancha <tino.calancha <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 21 Sep 2017 05:56:01 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Tino Calancha <tino.calancha <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 21 Sep 2017 05:58:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.0.60, send any further explanations to 28529 <at> debbugs.gnu.org and Richard Copley <rcopley <at> gmail.com> Request was from Tino Calancha <tino.calancha <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 21 Sep 2017 05:58:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 19 Oct 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 246 days ago.

Previous Next


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