Web lists-archives.com

Copying of symbolic links not working as expected




I'm experiencing a discrepancy between Linux cp and Cygwin cp when copying native symbolic links:

Test/
   FolderA/
      123/
      456/ -> 123/

On Linux I can:

> cp -r FolderA/ FolderB/

> ls -l FolderB/
total 0
drwxrwxr-x. 2 account group 45 Apr 21 05:47 123
lrwxrwxrwx. 1 account group  4 Apr 21 05:47 456 -> 123/

Entire folder copied with relative symblic link paths preserved.

*** (starting from the original state -- rm -rf FolderB/) ***

> mkdir FolderB/
> cp -r FolderA/456 FolderB/

> ls -l FolderB/
total 0
lrwxrwxrwx. 1 account group  4 Apr 21 05:47 456 -> 123/

Note that "456 -> 123/" in "FolderB/" is a BROKEN link. This is DESIRABLE as it preserves my curated symbolic links with their relative paths.

On Cygwin:

> cp -r FolderA/ FolderB/

... Works as expected

But:

> cp -r FolderA/456 FolderB/

ERRORS:

cp: cannot create symbolic link 'FolderB/456': No such file or directory

I know that there is no file or directory there. I'm trying to copy one to this location.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple