Package: coreutils
Version: 7.4-2
Severity: normal

If I create a directory structure such as the following:

  a:
  total 2
  drwxr-xr-x 2 bmc bmc 1024 2009-06-11 21:06 dir
  lrwxrwxrwx 1 bmc bmc    4 2009-06-11 21:06 link -> ../b
  
  a/dir:
  total 0
  lrwxrwxrwx 1 bmc bmc 7 2009-06-11 21:06 link -> ../../b
  
  b:
  total 2
  -rw-r--r-- 1 bmc bmc 5 2009-06-11 21:06 file

and then run "cp -aL a/* c", then the copies of file (in c) become hard
links to each other.  This behavior is not documented, and it does not
occur if I use -LR instead of -aL.  It appears to be triggered by
--preserve=links.

My opinion is that this behavior is incorrect[0], but I don't care very
much one way or the other.  If this behavior is intentional, it should
be clearly documented in the manual page, at the very least.  Either
changing the behavior or documenting the behavior[1] is satisfactory for
me.

A shell script is attached that demonstrates this problem.

[0] That is, --preserve=links should preserve symlinks as symlinks and
hard links as hard links.  Just because -L forces all symlinks to be
dereferenced does not mean that I want to "preserve" symlinks as hard
links.
[1] This information should be present in the manual page, not just in
the info page (which I almost never read).

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-rc8-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages coreutils depends on:
ii  libacl1                       2.2.47-2   Access control list shared library
ii  libattr1                      1:2.4.43-2 Extended attribute shared library
ii  libc6                         2.9-13     GNU C Library: Shared libraries
ii  libselinux1                   2.0.71-1   SELinux shared libraries

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
#!/bin/sh

rm -fr a b c
[ -d a ] || mkdir a
[ -d a/dir ] || mkdir a/dir
[ -d b ] || mkdir b
[ -d c ] || mkdir c
echo "File" > b/file
(cd a && ln -sf ../b link)
(cd a/dir && ln -sf ../../b link)
cp -aL a/* c

for i in c/link/file c/dir/link/file
do
        printf "%16s: " $i
        stat -c "%08d %08i %h" $i
done

Attachment: signature.asc
Description: Digital signature

Reply via email to