rdiff-backup-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Rdiff-backup-commits] rdiff-backup CHANGELOG rdiff_backup/cmodule.c r..


From: Andrew Ferguson
Subject: [Rdiff-backup-commits] rdiff-backup CHANGELOG rdiff_backup/cmodule.c r...
Date: Tue, 10 Jun 2008 12:55:59 +0000

CVSROOT:        /sources/rdiff-backup
Module name:    rdiff-backup
Changes by:     Andrew Ferguson <owsla> 08/06/10 12:55:59

Modified files:
        .              : CHANGELOG 
        rdiff_backup   : cmodule.c rpath.py 

Log message:
        Do not use inode numbers on Windows and gracefully handle attempts to
        rename over existing files on Windows. (Patch from Josh Nisly)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/CHANGELOG?cvsroot=rdiff-backup&r1=1.268&r2=1.269
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/cmodule.c?cvsroot=rdiff-backup&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/rdiff-backup/rdiff_backup/rpath.py?cvsroot=rdiff-backup&r1=1.118&r2=1.119

Patches:
Index: CHANGELOG
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/CHANGELOG,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -b -r1.268 -r1.269
--- CHANGELOG   9 May 2008 13:06:30 -0000       1.268
+++ CHANGELOG   10 Jun 2008 12:55:59 -0000      1.269
@@ -1,6 +1,9 @@
 New in v1.1.16 (????/??/??)
 ---------------------------
 
+Do not use inode numbers on Windows and gracefully handle attempts to
+rename over existing files on Windows. (Patch from Josh Nisly)
+
 Finally fix 'No such file or directory' bug when attempting to regress after
 a failed backup. (Patch from Josh Nisly)
 

Index: rdiff_backup/cmodule.c
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/cmodule.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- rdiff_backup/cmodule.c      8 Apr 2008 13:06:55 -0000       1.23
+++ rdiff_backup/cmodule.c      10 Jun 2008 12:55:59 -0000      1.24
@@ -66,6 +66,8 @@
 
 /* The following section is by Jeffrey A. Marshall and compensates for
  * a bug in Mac OS X's S_ISFIFO and S_ISSOCK macros.
+ * Note: Starting in Mac OS X 10.3, the buggy macros were changed to be
+ * the same as the ones below.
  */
 #ifdef __APPLE__
 /* S_ISFIFO/S_ISSOCK macros from <sys/stat.h> on mac osx are bogus */
@@ -116,13 +118,18 @@
          return NULL;
        }
   }
+#if defined(MS_WINDOWS)
+  size = PyLong_FromLongLong((PY_LONG_LONG)sbuf.st_size);
+  inode = PyLong_FromLongLong((PY_LONG_LONG)-1);
+#else
 #ifdef HAVE_LARGEFILE_SUPPORT
   size = PyLong_FromLongLong((PY_LONG_LONG)sbuf.st_size);
   inode = PyLong_FromLongLong((PY_LONG_LONG)sbuf.st_ino);
 #else
   size = PyInt_FromLong(sbuf.st_size);
   inode = PyInt_FromLong((long)sbuf.st_ino);
-#endif
+#endif /* HAVE_LARGEFILE_SUPPORT */
+#endif /* defined(MS_WINDOWS) */
   mode = (long)sbuf.st_mode;
   perms = mode & 07777;
 #if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)

Index: rdiff_backup/rpath.py
===================================================================
RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/rpath.py,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- rdiff_backup/rpath.py       6 Jan 2008 02:13:22 -0000       1.118
+++ rdiff_backup/rpath.py       10 Jun 2008 12:55:59 -0000      1.119
@@ -244,12 +244,22 @@
        log.Log(lambda: "Renaming %s to %s" % (rp_source.path, rp_dest.path), 7)
        if not rp_source.lstat(): rp_dest.delete()
        else:
-               if rp_dest.lstat() and rp_source.getinode() == 
rp_dest.getinode():
+               if rp_dest.lstat() and rp_source.getinode() == 
rp_dest.getinode() and \
+                               rp_source.getinode() != -1:
                        log.Log("Warning: Attempt to rename over same inode: %s 
to %s"
                                        % (rp_source.path, rp_dest.path), 2)
                        # You can't rename one hard linked file over another
                        rp_source.delete()
-               else: rp_source.conn.os.rename(rp_source.path, rp_dest.path)
+               else:
+                       try:
+                           rp_source.conn.os.rename(rp_source.path, 
rp_dest.path)
+                       except OSError, error:
+                               if error.errno != errno.EEXIST: raise
+
+                               # On Windows, files can't be renamed on top of 
an existing file
+                               rp_source.conn.os.unlink(rp_dest.path)
+                               rp_source.conn.os.rename(rp_source.path, 
rp_dest.path)
+                           
                rp_dest.data = rp_source.data
                rp_source.data = {'type': None}
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]