GNU bug report logs - #17103
cp: "cp -al" doesn't copy symlinks, tries to link to them

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Wed, 26 Mar 2014 18:09:01 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Linda Walsh <coreutils <at> tlinx.org>
Cc: 17103 <at> debbugs.gnu.org
Subject: bug#17103: regression: cp -al doesn't copy symlinks, but tries to link to them (fail)
Date: Wed, 26 Mar 2014 19:57:50 +0000
On 03/26/2014 06:08 PM, Linda Walsh wrote:
> have a simple test case:
> as root (w /umask 002):
> 
> mkdir -p dir/{a,b}
> touch dir/b/file
> ln -s ../b/file dir/a/symfile
> ---
> 
> So now tree should look like:
> 
>>  tree -AFugp dir
> 
> dir
> +-- [drwxrwxr-x root     root    ]  a/
> |   +-- [lrwxrwxrwx root     root    ]  symfile -> ../b/file
> +-- [drwxrwxr-x root     root    ]  b/
>     +-- [-rw-rw-r-- root     root    ]  file
> ----
> 
> Now, w/normal user, who is in group root, try:
> 
> cp -al dir dir2
> cp: cannot create hard link ‘dir2/dir/a/symfile’ to ‘dir/a/symfile’: Operation not permitted
> -----
> 
> Trying to link to a symlink is the bug --
> it used to duplicate the symlink.
> 
> This is a recent behavior
> change -- i.e. looking at earlier behavior, the symlinks,
> like the directories are created as the 'user', and
> only files are linked to.
> 
> Core utils version: 8.21 (suse rpm coreutils-8.21-7.7.7.x86_64)
> 
> Any idea how this managed to be broken?

So I think the change to use hardlinks to symlinks rather than new symlinks happened with:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=594292a1

I.E. The "new symlink" behaviour only happened between v8.0 and v8.10 inclusive.

So why is the hardlink to symlink being disallowed?
I wonder is it due to "protected_hardlinks":
http://danwalsh.livejournal.com/64493.html

If we fell back to using symlinks, would that only
push the perm issue on to when the symlink was followed?

Pádraig.




This bug report was last modified 6 years and 158 days ago.

Previous Next


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