rsync 2.3.2 with --copy-unsafe-links work badly

Vladimir Michl vladimir.michl at hlubocky.del.cz
Tue Apr 2 18:43:06 EST 2002


Hello,

I try use rsync from Debian 2.2 (rsync 2.3.2) to mirror Debian
distribution tree.

in tree is directories

dists/potato/main/binary-all/
dists/potato/main/binary-i386/
pool/

In directory dists/potato/main/binary-i386/ is some files symbolic links
to ../binary-all/ and some links to ../../../../pool/

In mirror I want preserve links to binary-all/ and copy as files links
to pool/. I try use this rsync command:

rsync -a --delete --copy-unsafe-links ftp.debian.cz::/debian/dists/potato/ \
/home/debian/potato

The result of this is, than all files is copied as regular files and
symlinks are not preserved.

I wrote test script (attached) which demonstrate error.

Is this error fixed in rsync 2.5.5? I try look to archive of mailing list,
and do not find any question about --copy-unsafe-links.

If I mirror from rsync server, must be fixed rsync server or rsync client
or both.

Best regards

Vladimir
---------------------------------------------------------------------------
Vladimír Michl <Vladimir.Michl at hlubocky.del.cz>
Del a.s., Strojírenská 38, Žďár nad Sázavou
pobočka Olomoucká 355, Hlubočky-Mariánské Údolí
tel: +420 68 5353548, fax: +420 68 5352364
http://hlubocky.del.cz
-------------- next part --------------
#!/bin/sh

function test_symlink () {
	if [ ! -L $1 ]; then
		echo "File $1 is not symlink or not exists";
	fi;
};

function test_regular () {
	if [ ! -f $1 ]; then
		echo "File $1 is not regular file or not exists";
	fi;
};

function test_copy () {
	test_symlink dest/links/file1;
	test_symlink dest/links/file2;
	test_regular dest/links/unsafefile;
};

rm -rf src dest

mkdir -p src/safe
mkdir -p src/unsafe

mkdir src/safe/files
mkdir src/safe/links

touch src/safe/files/file1
touch src/safe/files/file2
touch src/unsafe/unsafefile

ln -s ../files/file1 src/safe/links/
ln -s ../files/file2 src/safe/links/
ln -s ../../unsafe/unsafefile src/safe/links/

#next rsync copy correctly
echo "rsync with relative path";
rsync -a --copy-unsafe-links src/safe/ dest
test_copy;

rm -rf dest
#next rsync copy uncorectly - links are copied as files not as links
echo "rsync with relative2 path";
(cd src; rsync -a --copy-unsafe-links safe/ ../dest)
test_copy;

rm -rf dest
#next rsync copy uncorectly - all links are copied
echo "rsync with absolute path";
rsync -a --copy-unsafe-links `pwd`/src/safe/ dest
test_copy;



More information about the rsync mailing list