Bug or feature? --delete-after + symlinks

J. Milgram milgram at cgpp.com
Tue Jan 7 02:45:01 EST 2003


Hi,

sorry if this is old stuff, but I did my best to look first...

Have been getting errors along these lines:

mv mydir mdir.2002
ln -s mydir.2002 mydir

Then update mirror with rsync -av --delete-after. Without
--delete-after, no problem, with --delete-after, get a code 23.

The attached shell script will recreate the error (on my machine, at
any rate). Just run it from a clean directory.

Don't know if this is a bug or a feature. I did see the bit in the
TODO list about duplicate names and symlinks, this passage seems
relevant: "We don't need to worry about hard links causing duplicates
because files are never updated in place.  Similarly for symlinks."

For now, I'll just live without --delete-after but it would be useful
to have at some point, so grateful for any tips.

thanks!

- Judah Milgram
milgram at cgpp.com


#!/bin/bash
#
# 1. rename a directory.
# 2. create symlink with old dir's name.
# 3. update mirror
#

RSYNC=/usr/bin/rsync

uname -msrp
ldd $RSYNC
$RSYNC --version

# This seems to trigger error with rsync version 2.5.5  protocol version 26
RSYNCFLAGS="-av --delete-after"

# This seems OK
# RSYNCFLAGS="-av"

# set up source directory

echo
mkdir a
mkdir a/b
touch a/b/foo
find a

# mirror to target

echo
$RSYNC $RSYNCFLAGS a a_mirror
find a a_mirror

# Now do some reorganization in source dir:

echo
cd a
mv -v b b.1
ln -sv b.1 b
cd ..

# Now mirror again: 
$RSYNC $RSYNCFLAGS a a_mirror
find a a_mirror

# end

output from above:


Linux 2.4.18 i686 unknown
        libpopt.so.0 => /usr/lib/libpopt.so.0 (0x40027000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x4002d000)
        libc.so.6 => /lib/libc.so.6 (0x4003d000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
rsync  version 2.5.5  protocol version 26
Copyright (C) 1996-2002 by Andrew Tridgell and others
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, 
              IPv6, 64-bit system inums, 64-bit internal inums

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

a
a/b
a/b/foo

building file list ... done
created directory a_mirror
a/b/foo
wrote 127 bytes  read 36 bytes  108.67 bytes/sec
total size is 0  speedup is 0.00
a
a/b
a/b/foo
a_mirror
a_mirror/a
a_mirror/a/b
a_mirror/a/b/foo

`b' -> `b.1'
create symbolic link `b' to `b.1'
building file list ... done
a/
delete_file: rmdir(a/b) : Directory not empty
rsync: symlink "a/b" -> "b.1": File exists
a/b.1/
a/b.1/foo
deleting a/b/foo
wrote 155 bytes  read 36 bytes  382.00 bytes/sec
total size is 3  speedup is 0.02
rsync error: partial transfer (code 23) at main.c(578)
a
a/b
a/b.1
a/b.1/foo
a_mirror
a_mirror/a
a_mirror/a/b
a_mirror/a/b.1
a_mirror/a/b.1/foo



More information about the rsync mailing list