delete fails to delete everything it should like dangling symlinks

Phil Howard phil-rsync at
Fri Mar 8 17:35:14 EST 2002

I think someone posted this before, but I can't find it in the archives.

I am using rsync to pull down source files to be compiled.  The delete
options are used to clear out any old files left over from previous.
Normally this works.  I've run into one case where it persistently fails.

Within the directory created during compiling is a symlink to another
directory, also created during compiling (well, literally, during tar
extraction done by the script that does the compiling).  When rsync is
run to re-syncronize, which should delete all created files (including
all those extracted from the tar file), the directory that is the target
of the symlink apparently is deleted first.  Then when the symlink is
encountered, I get an error saying that readlink gets No such file or
directory.  This doesn't make sense since readlink should work on a
dangling link.

Here's a paste of manually doing the rsync within the same host
(warning, the first line is 318 characters long):

root at pollux:/home/root/src 152> rsync --checksum --copy-unsafe-links --compress '--exclude=*~' '--exclude=#*#' --force --group --links --owner --partial --perms --progress --recursive --timeout=150 --times --verbose --delete --delete-after --delete-excluded --ignore-errors --force /home/root/src-pub/ /home/root/src/
rsync: building file list...
rsync: 809 files to consider.
readlink openssl-0.9.6b/work/openssl-0.9.6b/crypto/des/asm/perlasm: No such file or directory
readlink openssl-0.9.6c/tmp/openssl-0.9.6c/crypto/des/asm/perlasm: No such file or directory
wrote 34720 bytes  read 20 bytes  4087.06 bytes/sec
total size is 85523954  speedup is 2461.83
rsync error: partial transfer (code 23) at main.c(576)
root at pollux:/home/root/src 153> readlink openssl-0.9.6c/tmp/openssl-0.9.6c/crypto/des/asm/perlasm
root at pollux:/home/root/src 154> rsync --version
rsync  version 2.5.2  protocol version 26
Copyright (C) 1996-2002 by Andrew Tridgell and others
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, IPv6,
              32-bit system inums, 64-bit internal inums
root at pollux:/home/root/src 155>

As you can see I'm using a number of options that should, according
to the man page, make sure things get deleted.  But this is not

I assume that "partial transfer (code 23)" error message is because
it did recognize that it failed to completely get things in sync.

BTW, after manually deleting the 2 symlinks, it works fine:

root at pollux:/home/root/src 155> rm -f openssl-0.9.6b/work/openssl-0.9.6b/crypto/des/asm/perlasm
root at pollux:/home/root/src 156> rm -f openssl-0.9.6c/tmp/openssl-0.9.6c/crypto/des/asm/perlasm
root at pollux:/home/root/src 157> rsync --checksum --copy-unsafe-links --compress '--exclude=*~' '--exclude=#*#' --force --group --links --owner --partial --perms --progress --recursive --timeout=150 --times --verbose --delete --delete-after
--delete-excluded --ignore-errors --force /home/root/src-pub/ /home/root/src/
rsync: building file list...
rsync: 809 files to consider.
deleting directory openssl-0.9.6c/tmp/openssl-0.9.6c/crypto/des/asm
deleting directory openssl-0.9.6c/tmp/openssl-0.9.6c/crypto/des
deleting directory openssl-0.9.6c/tmp/openssl-0.9.6c/crypto
deleting directory openssl-0.9.6c/tmp/openssl-0.9.6c
deleting directory openssl-0.9.6c/tmp
deleting directory openssl-0.9.6b/work/openssl-0.9.6b/crypto/des/asm
deleting directory openssl-0.9.6b/work/openssl-0.9.6b/crypto/des
deleting directory openssl-0.9.6b/work/openssl-0.9.6b/crypto
deleting directory openssl-0.9.6b/work/openssl-0.9.6b
deleting directory openssl-0.9.6b/work
wrote 34720 bytes  read 20 bytes  4087.06 bytes/sec
total size is 85523954  speedup is 2461.83
root at pollux:/home/root/src 158>

| Phil Howard - KA9WGN |   Dallas   | |
| phil-nospam at | Texas, USA |     |

More information about the rsync mailing list