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


Message #38 received at 17103 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Linda Walsh <coreutils <at> tlinx.org>
Cc: 17103 <at> debbugs.gnu.org
Subject: Re: bug#17103: regression: cp -al doesn't copy symlinks, but tries
 to link to them (fail)
Date: Wed, 26 Mar 2014 16:58:36 -0700
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. 
 The problem affects all applications, e.g., 'ln'.

Not much that coreutils can do about it, as far as I can see, as it's a 
kernel issue.

You can work around the problem by running 'cp' (or 'ln' etc.) as root.

Here's an example, where I am running as a regular (non-root) user that 
is not in the 'root' group:

$ find dir/a -ls
5300828    0 drwxrwxr-x   2 root     root           80 Mar 26 16:50 dir/a
5338695    4 -rw-r--r--   1 root     root            5 Mar 26 16:50 
dir/a/data
5300831    0 lrwxrwxrwx   1 root     root            9 Mar 26 11:20 
dir/a/symfile -> ../b/file
$ mkdir d
$ ln dir/a/data d
ln: failed to create hard link ‘d/data’ => ‘dir/a/data’: Operation not 
permitted
$ ln dir/a/symfile d
ln: failed to create hard link ‘d/symfile’ => ‘dir/a/symfile’: Operation 
not permitted





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

Previous Next


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