bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15173: [cp] --link overrides dereference settings


From: Bernhard Voelker
Subject: bug#15173: [cp] --link overrides dereference settings
Date: Thu, 31 Oct 2013 03:07:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

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

Attachment: cp--link--deref-v2.patch
Description: Text Data

Attachment: testit.log.xz
Description: application/xz

Attachment: testit.sh
Description: application/shellscript


reply via email to

[Prev in Thread] Current Thread [Next in Thread]