GNU bug report logs - #33155
cp: copy from symlink -> to symlink?

Previous Next

Package: coreutils;

Reported by: L A Walsh <coreutils <at> tlinx.org>

Date: Thu, 25 Oct 2018 19:59:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 33155 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#33155; Package coreutils. (Thu, 25 Oct 2018 19:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to L A Walsh <coreutils <at> tlinx.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 25 Oct 2018 19:59:02 GMT) Full text and rfc822 format available.

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

From: L A Walsh <coreutils <at> tlinx.org>
To: Coreutils <bug-coreutils <at> gnu.org>
Subject: rfe?  cp from symlink -> to symlink? cp symlink meta-info(target)
 with "-a"? (vs. no diagnostic)
Date: Thu, 25 Oct 2018 12:58:20 -0700
Created following test dir (as seen by tree) in /tmp
>  tree mybin
Ishtar:/tmp> tree mybin
mybin
├── iptool -> alt-tool         #broken link
├── iptool-restore -> iptool   #broken link
├── iptool-save -> iptool      #broken link
└── usr
   └── mybin
       ├── alt-tool
       ├── iptool -> alt-tool
       ├── iptool-restore -> iptool
       ├── iptool-save -> iptool
       ├── junka
       ├── junkb
       └── junkc

3 directories, 9 files
----
So first I try copying iptool-save from mybin/usr/mybin to /tmp/mybin

Ishtar:/tmp/mybin/usr/mybin> cp --preserve=all iptool-save /tmp/mybin/
cp: not writing through dangling symlink '/tmp/mybin/iptool-save'

  then try:
Ishtar:/tmp/mybin/usr/mybin> /bin/cp -r --preserve=all -iptool-save 
/tmp/mybin/
(and get no error message)

It seems to have _re_copied the link (time is updated on that link)
but it didn't recursively follow the link and copy the destination.
(nor with -a).  Why did it act as though I said "force" and recopy the
link (unexpected), but didn't recursively follow the link to its target?
(not entirely expected, but wanted).

Especially if I use '-a', shouldn't copying a symlink also copy the
material pointed to -- i.e. duplicated the symlink structure at the target?

One *could* consider the target file "metadata" of the symlink, so at least,
"-a" could cover that case.

It seems odd to silence the diagnostic with "-r" and "-a", but not
recursively follow the link...(I know traditionally -r has referred to
directory structure, but in this case it would be more important & useful
to copy the symlink structure -- ESPECIALLY, since the target symlink
does not exist.  Maybe only overwrite symlink target with "-af"?













Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 30 Oct 2018 04:10:02 GMT) Full text and rfc822 format available.

Changed bug title to 'cp: copy from symlink -> to symlink?' from 'rfe? cp from symlink -> to symlink? cp symlink meta-info(target) with "-a"? (vs. no diagnostic)' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 30 Oct 2018 04:10:02 GMT) Full text and rfc822 format available.

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

Previous Next


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