Subject: Re: bug#10897: copy-directory create new directory when copying a symlink

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 25 Aug 2020 14:47:07 +0200

Thierry Volpiatto <[email-masked]> writes:

> when copying a directory symlink to another directory, the behavior of
> 'cp' is to create a new symlink in this directory:
>
> thierry@thierry-MM061:~ $ mkdir ~/Test
> thierry@thierry-MM061:~ $ mkdir ~/tmp/Test1
> thierry@thierry-MM061:~ $ ln -s ~/tmp/Test1 ~/tmp/foo
> thierry@thierry-MM061:~ $ cp -r ~/tmp/foo ~/Test
> thierry@thierry-MM061:~ $ ls -l ~/Test
> total 0
> lrwxrwxrwx   1 thierry        thierry  23 2012-02-27 09:08 foo -> /home/thierry/tmp/Test1
>
> It is not what's copy-directory does:
>
> (copy-directory "~/tmp/foo" "~/Test" nil t)
> =>
> thierry@thierry-MM061:~ $ ls -l ~/Test
> total 4
> drwxrwxr-x   2 thierry        thierry  4096 2012-02-27 09:11 foo

I'm unable to reproduce the bug using this recipe -- at the end of this,
I just have an empty ~/Test directory.

Which is also different from what cp -r does, but I'm not sure that's a
bug -- when you tell copy-directory to copy a symlink, I think it's
natural to dereference that symlink first?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no