On Mon, Mar 08, 2010 at 10:02:26AM -0600, Mike Bombich wrote:
> rsync: make_bak_dir mkdir 
> "/Volumes/Backup/_Archive_2010_March_07_22-27-43/Users/jsmith/Library/Mail/Mailboxes/
>    Orchestra" failed: File exists

Is something else creating that directory at the same time?  A race
where 2 processes are creating the same directory would be pretty rare,
though, so it makes me think that OS X is really failing with the wrong
error for a filename it doesn't like.  I note that the next element has
an asterisk in it -- should that work OK on that filesystem?

> rsync: keep_backup failed: 
> "/Volumes/Backup/Users/jsmith/Library/Mail/Mailboxes/   Orchestra/    * New 
> Mexico Concert/Assistant - John Smith.mbox/Messages/269981.emlx" -> 
> "_Archive_2010_March_07_22-27-43/Users/jsmith/Library/Mail/Mailboxes/   
> Orchestra/    * New Mexico Concert/Assistant - John 
> Smith.mbox/Messages/269981.emlx": No such file or directory

Note that this error is for the backup -- since the full path does not
exist, trying to create the backup file returns the ENOENT error.

>               if (mkdir_defmode(fbuf) == 0 || errno == EEXIST) // <-- Trap 
> for EEXIST?

The reason I hadn't done that before was because EEXIST gets returned
for any file type -- e.g. file or dir.  But this should be OK for the
make_bak_dir() function because it will always be followed up with
either another mkdir() or an attempt to use the path, which should fail
with ENOTDIR if it momentarily accepts a non-dir.  You might try the
attached patch and see if it helps.

..wayne..
index 7512d92..67973e4 100644
--- a/backup.c
+++ b/backup.c
@@ -116,7 +116,7 @@ int make_bak_dir(const char *fullpath)
 			return -1;
 		if (*p == '/') {
 			*p = '\0';
-			if (mkdir_defmode(fbuf) == 0)
+			if (mkdir_defmode(fbuf) == 0 || errno == EEXIST)
 				break;
 			if (errno != ENOENT) {
 				rsyserr(FERROR, errno,
@@ -173,7 +173,7 @@ int make_bak_dir(const char *fullpath)
 		p += strlen(p);
 		if (p == end)
 			break;
-		if (mkdir_defmode(fbuf) < 0) {
+		if (mkdir_defmode(fbuf) < 0 && errno != EEXIST) {
 			rsyserr(FERROR, errno, "make_bak_dir mkdir %s failed",
 				full_fname(fbuf));
 			return -1;
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to