Bug 4979 - readdir() failure results in remote deletes
Summary: readdir() failure results in remote deletes
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.0.0
Hardware: PPC Mac OS X
: P3 major (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-17 22:45 UTC by Joe Holt
Modified: 2008-07-26 10:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Holt 2007-09-17 22:45:41 UTC
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.

rsync command:
sudo ./rsync --rsync-path=/alias/upkeep/rsync --verbose --archive --xattrs --delete --stats /Volumes/KidD/ /Volumes/KidD_b/
Comment 1 Wayne Davison 2007-10-14 16:40:33 UTC
This is fixed in the CVS version, and will be present in the 3.0.0pre3 release (when that occurs).  Thanks for the report!