Web lists-archives.com

Broken junctions and symlinks halt recursive cp and rsync operations?




I can make a directory 'a/' and a symlink 'b' of 'b -> a' and copy 'b' to 'c' which also points to 'a':

$mkdir a
$CYGWIN= ln -s a b
$CYGWIN= cp -a b c

On Linux if I break the link as such:

$rm -r a c

I can still copy the broken link:

$cp -a b c

But on Cygwin I cannot do this for native junctions and native symbolic links (note that Cygwin symlinks work fine in this scenario). This issue breaks both cp and rsync when working with either form of native links.

$rm -r a b c

$mkdir a
$CYGWIN=winsymlinks:nativestrict ln -s a b
$rm -r a

See here:

$CYGWIN=winsymlinks:nativestrict cp -a b c
cp: cannot create symbolic link 'c': No such file or directory

And:

$rsync -a b c
rsync: symlink "/c/test/c" -> "a" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

Is there a way to recover from this? It breaks copy operations of directories which contain broken symlinks where I would expect the broken link to be copied as-is.


Matt D.

--
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