rsync misbehavior on cygwin with network drive

Nikolay Igotti nike at lyola.com
Thu Mar 9 23:48:42 GMT 2006


  I noticed that rsync on Cygwin fails to synchronize readonly files, if 
those are on the network drive.

Following simple patch fixes the problem:

*** rsync-2.6.6/util.c  Thu Jul  7 23:49:14 2005
--- util.c      Fri Mar 10 02:46:31 2006
***************
*** 380,385 ****
--- 380,402 ----
                                return -1;
                        break;
  #endif
+                 /* Cygwin somewhat misbehaves with R/O files on 
network drive
+                    by returning EACCES from rename(), and this workaround
+                    fixes the problem */
+                 case EACCES:
+                        {
+                         STRUCT_STAT st;
+                         if (do_stat(from, &st) < 0) {
+                                 return -1;
+                         }
+                         do_chmod(from, 0700);
+                         if (do_rename(from, to) < 0) {
+                                 return -1;
+                         }
+                         do_chmod(to, st.st_mode);
+                         return 0;
+                        }
+
                case EXDEV:
                        if (copy_file(from, to, mode) != 0)
                                return -2;
 


More information about the rsync mailing list