Odd issue with locked directories and Mac OS X

Mike Bombich mike at bombich.com
Wed Mar 11 03:20:01 GMT 2009


Some of my users have reported problems with rsync puking on locked  
folders.  The errors typically look like this:

rsync -aNHAXx --fileflags --force-change --no-inc-recursive / /Volumes/ 
Backup

> rsync: mkstemp "/Volumes/SCSI Backup/Users/Ken/Library/Caches/ 
> Metadata/Safari/Bookmarks/..DS_Store.N9xtNy" failed: Operation not  
> permitted (1) (51)
> rsync: mkstemp "/Volumes/SCSI Backup/Users/Ken/Library/Caches/ 
> Metadata/Safari/History/..DS_Store.7emP4V" failed: Operation not  
> permitted (1) (51)


Presumably rsync is unable to create the temporary files in the folder  
on the target because it is locked.  For the life of me, I can't  
reproduce this issue, nor could I figure out how it could be happening  
based on how rsync handles locked directories with the --force-change  
argument.  The patch pasted in below seems to resolve it though.  Any  
insight would be appreciated.

Mike



diff -Naur rsync-3.0.5_base/receiver.c rsync-3.0.5/receiver.c
--- rsync-3.0.5_base/receiver.c	2008-11-15 16:49:28.000000000 -0600
+++ rsync-3.0.5/receiver.c	2009-03-10 22:18:20.000000000 -0500
@@ -39,6 +42,7 @@
  extern int preserve_hard_links;
  extern int preserve_perms;
  extern int preserve_xattrs;
+extern int force_change;
  extern int basis_dir_cnt;
  extern int make_backups;
  extern int cleanup_got_literal;
@@ -153,6 +157,20 @@
  	}
  #endif

+#ifdef SUPPORT_FORCE_CHANGE
+	if (fd == -1) {
+		stat_x sx;
+		if (do_stat(file->dirname, &sx.st) < 0)
+			rprintf(FINFO, "Failed to stat %s!\n", full_fname(file->dirname));
+		else {
+			if (force_change && make_mutable(file->dirname, sx.st.st_mode,  
sx.st.st_flags, force_change) > 0) {
+				fd = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS);
+				undo_make_mutable(file->dirname, sx.st.st_flags);
+			}
+		}
+	}
+#endif
+
  	if (fd == -1) {
  		rsyserr(FERROR_XFER, errno, "mkstemp %s failed",
  			full_fname(fnametmp));

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the rsync mailing list