GNU bug report logs - #15173
[cp] --link overrides dereference settings

Previous Next

Package: coreutils;

Reported by: Gian Piero Carrubba <gpiero <at> rm-rf.it>

Date: Fri, 23 Aug 2013 21:55:02 UTC

Severity: normal

Tags: fixed

Merged with 23120

Done: Bernhard Voelker <mail <at> bernhard-voelker.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: 15173 <at> debbugs.gnu.org
Subject: bug#15173: [PATCH] cp: with --link always use linkat() if available
Date: Mon, 10 Feb 2014 02:18:10 +0000
[Message part 1 (text/plain, inline)]
On 12/12/2013 06:44 PM, Pádraig Brady wrote:
> On 12/09/2013 02:24 AM, Pádraig Brady wrote:
>> Sorry if you get multiple copies of this.
>>
>> The test for this is failing on solaris 10 (NFS)
>> It does seem that hardlinks to symlinks are supported:
>>
>> $ touch tfile
>> $ ln -s tfile tlink
>> $ src/ln -L tlink tlink-ln-L
>> $ src/ln -P tlink tlink-ln-P
>> $ src/ln tlink tlink-ln
>> $ ls -li tfile tlink*
>>       8550 -rw-r--r--   3 padraig  csw            0 Dec  9 01:18 tfile
>>       8551 lrwxrwxrwx   2 padraig  csw            5 Dec  9 01:19 tlink -> tfile
>>       8550 -rw-r--r--   3 padraig  csw            0 Dec  9 01:18 tlink-ln
>>       8550 -rw-r--r--   3 padraig  csw            0 Dec  9 01:18 tlink-ln-L
>>       8551 lrwxrwxrwx   2 padraig  csw            5 Dec  9 01:19 tlink-ln-P -> tfile
>>
>> But we have linkat() emulation in place I think:
>>
>> $ grep LINK lib/config.h
> ...
>> /* #undef HAVE_LINKAT */
>> #define LINK_FOLLOWS_SYMLINKS -1
> 
>> FAIL: tests/cp/link-deref
>> =========================
> 
>> --- exp	Mon Dec  9 01:00:08 2013
>> +++ out	Mon Dec  9 01:00:08 2013
>> @@ -1,1 +1,1 @@
>> -cp --link -P  dirlink dst|result=0|inode=8436|type=symbolic link|error=
>> +cp --link -P  dirlink dst|result=0|inode=8467|type=symbolic link|error=
>> + rm -f diff.out
>> + false
>> + ls -lid dirlink dir dst
>> 8434 drwxr-xr-x 2 padraig csw 2 Dec  9 01:00 dir
>> 8436 lrwxrwxrwx 1 padraig csw 3 Dec  9 01:00 dirlink -> dir
>> 8467 lrwxrwxrwx 1 padraig csw 3 Dec  9 01:00 dst -> dir
>> + fail=1
> 
> So the attached should address this on FreeBSD ast least
> where we HAVE_LINKAT so don't need to fallback to
> the symlink -> symlink emulation in copy.c

I still think this is correct, and while I didn't think it
worth the small risk right before the 8.22 release,
I hope to push this rebased patch soon.

thanks,
Pádraig.
[cp-linkat.patch (text/x-patch, attachment)]

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

Previous Next


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