Subject: bug#5982: 23.1.96; Dired regression - recursive copies turn symlinks into regular files

From: Sven Joachim <[email-masked]>
Date: Tue, 20 Apr 2010 15:49:33 +0200

On 2010-04-20 11:26 +0200, Sven Joachim wrote:

> Suppose we have the following directory in dired:
>
> ,----
> |   /tmp/foo:
> |   total used in directory 4 available 1674380
> |   drwxr-xr-x  2 sven sven  80 Apr 20 11:12 .
> |   drwxrwxrwt 14 root root 300 Apr 20 11:12 ..
> |   -rw-r--r--  1 sven sven   6 Apr 20 11:09 bar
> |   lrwxrwxrwx  1 sven sven   3 Apr 20 11:12 bar2 -> bar
> `----
>
> Now type ^ to cd to the parent directory, move to the "foo" line and
> press "C /tmp/foo2 RET yes" (confirming the recursive copy and creating
> /tmp/foo2) and switch to the new directory.  It looks like this:
>
> ,----
> |   /tmp/foo2:
> |   total used in directory 8 available 1674380
> |   drwxr-xr-x  2 sven sven  80 Apr 20 11:12 .
> |   drwxrwxrwt 14 root root 300 Apr 20 11:12 ..
> |   -rw-r--r--  1 sven sven   6 Apr 20 11:09 bar
> |   -rw-r--r--  1 sven sven   6 Apr 20 11:09 bar2
> `----
>
> This is a regression from Emacs 23.1 and 22.3 where the symlink would be
> copied as such instead of turning into a regular file.

Bisecting shows that this problem first occured in revision 97979 when
dired-copy-file-recursive started to use the new copy-directory command
(added in revision 97978).  The latter just calls copy-file for
non-directories, and copy-file has no option to preserve symlinks.

Sven