Subject: bug#28483: 26.0.50; copy-directory does not create directories

From: Eli Zaretskii <[email-masked]>
Date: Wed, 20 Sep 2017 14:26:56 +0300

> From: Paul Eggert <[email-masked]>
> Date: Sun, 17 Sep 2017 13:40:45 -0700
> 
> The recent security patch to copy-directory had the unintended side effect of 
> refusing to make the destination directory when COPY-CONTENTS is non-nil and 
> when the destination is a directory name. Sorry about that. I installed a patch 
> in the emacs-26 branch, here:
> 
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-26&id=37b5e661d298cbfe51422cd515b6696a1cdaa868
> 
> Please give it a try. As I think it fixes the bug, I'm boldly closing this bug 
> report; we can reopen it if I'm wrong.

Thanks.

I still see a problem in copy-directory if I modify the original
recipe slightly: by having the directory ~/test2/a empty (in the
original recipe it included one file. ~/test2/a/e).  If that directory
is empty, it is not copied to the destination.  Moreover, the logic in
copy-directory transfers the modes and timestamp of the (not-copied)
directory to the destination directory, not to the copy.

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.