I'm using rsync 3.0 to duplicate one hard drive to another. Today the source drive failed, but in a way that left it appearing to be online and partially functional. When I attempted to use rsync it reported:
rsync: readdir("/Volumes/KidD/."): Input/output error (5)
And then proceeded to delete every file and directory on the remote volume. It appears that rsync is not handling this error properly, and that it's treating it as an empty directory.
The problem is in send_directory() in flist.c. opendir() apparently worked on my bad volume but readdir() failed. I don't grok the code well enough to suggest a patch, but I see that errno gets reported at the bottom of the function but it doesn't short-circuit the remainder of the code, in the way the error handling on opendir() does earlier in the routine. Is send_if_directory() still getting called? Does this look like an empty directory to the remote rsync?
rsync built with cvs root a week or two ago.
sudo ./rsync --rsync-path=/alias/upkeep/rsync --verbose --archive --xattrs --delete --stats /Volumes/KidD/ /Volumes/KidD_b/
This is fixed in the CVS version, and will be present in the 3.0.0pre3 release (when that occurs). Thanks for the report!