Subject: bug#17103: regression: cp -al doesn't copy symlinks, but tries to link to them (fail)

From: Linda Walsh <[email-masked]>
Date: Wed, 26 Mar 2014 17:16:16 -0700

Paul Eggert wrote:
> I've managed to reproduce the problem on Fedora 20.  It indeed is a 
> kernel thing having to do with security.  Not only can 'cp' not create 
> hardlinks to symlinks; it also can't create hardlinks to regular files. 
----
Actually, we've already verified that creating hardlinks to regular
files works because I have write access to the file I am linking to.

I also have write access to the symlink if you look at the mode-bits.

Pádraig Brady also verified this.

There is more than one problem or issue here.

The part that is in coreutils is that if for some reason a symlink
cannot be linked to, then the symlink should be copied (not what
the symlink is pointing to, but the actual contents of the symlink
inode -- i.e. the redirection path).  Like directories copied with
cp -al, symlinks would be owned by the user if this situation comes
up -- but they would still be functional.

The kernel part of this are the changes associated with
/proc/sys/fs/protected_{hard,soft}links -- which seem to be on by default
resulting in incompatible behavior.  Pádraig referenced a blog
where these new behaviors were justifiable on  the theory that
sys admins might be easily tricked into doing random chowns of all
files for users on request without investigating or wondering why...
*ahem*...yah...