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: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: Gian Piero Carrubba <gpiero <at> rm-rf.it>, 15173 <at> debbugs.gnu.org
Subject: bug#15173: [cp] --link overrides dereference settings
Date: Thu, 31 Oct 2013 03:07:33 +0100
[Message part 1 (text/plain, inline)]
On 10/30/2013 01:13 PM, Bernhard Voelker wrote:
> Thanks again for looking into this.  It's really quite complex.
> I'll come up with the test (old vs. new) cases soon.

Okay, here we go:

the attached patch is updated regarding the issues you mentioned.

I furthermore tweaked the NEWS entry:

* instead of just mentioning the --dereference option,
mention both the -L and -H options explicitly.

* add a note that "cp -l dangling" and "cp -l symlink-to-dir"
now create hard links as expected - cp doesn't try to dereference
the src anymore which would lead to different error diagnostics
in the two cases [*].

Then, I created a few test cases to check the changes in behaviour
of cp-8.21 against the changed cp.  It runs various combinations of
the options -l, -s, -R, -H, -L, -P and --preserve=links on symlinks
to a file ('filelink'), to a directory ('dirlink') and on a dangling
symlink ('danglink').
The script is already ugly enough, so I omitted checking the
files, dir and links in the subdirectory for changes.
The changes so far - 12 out of 144 - are:

  $ grep "DIFFERENCE in Test: " testit.log | sed 's/^.*: //'
  cp -L -l   filelink ...
  cp -L -l  --preserve=links filelink ...
  cp -L -l -R  filelink ...
  cp -L -l -R --preserve=links filelink ...
  cp -H -l   filelink ...
  cp -H -l  --preserve=links filelink ...
  cp -H -l -R  filelink ...
  cp -H -l -R --preserve=links filelink ...
  cp  -l   dirlink ...
  cp  -l  --preserve=links dirlink ...
  cp  -l   danglink ...
  cp  -l  --preserve=links danglink ...

I think these are all okay.

[*] IMO even the 4 latter changes are okay and don't contradict to
POSIX: --link is not specified by POSIX.

BTW: The failures "can make relative symbolic links only in current directory"
for e.g. "cp -L -s -R  dirlink" are interesting but a different case, i.e.,
cp's behavior didn't change.

WDYT?

Finally, the testsuite is still broken (tests/cp/same-file), and new
tests for "cp -l[LH]" are also still missing.

Have a nice day,
Berny
[cp--link--deref-v2.patch (text/x-patch, attachment)]
[testit.log.xz (application/x-xz, attachment)]
[testit.sh (application/x-shellscript, attachment)]

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

Previous Next


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