[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Duplicity-talk] Fix for corrupted archives with cygwin and python 2.3
From: |
Nick Burch |
Subject: |
[Duplicity-talk] Fix for corrupted archives with cygwin and python 2.3 |
Date: |
Mon, 2 Aug 2004 11:08:50 +0100 (BST) |
Hi All
I recently hit a problem with duplicity running on cygwin producing
corrupted tar files. I tracked this down to overflowing the file owner
header field, in the case where cygwin didn't know the owner.
Cygwin was returning a uid of -1 in the case that it didn't know the owner
of a file (eg owner was a group). ls -l on such a file returned ???????
for the owner. duplicity was passing this value of -1 into the formatting
%07o, which was returing a value that was too large for the field size.
This was then causing the tar file to be corrupt. (I think python 2.1
cheated and returned a value of the right size, so it probably wasn't
noticed before)
This fix is quite simple - detect the -1 value, and substitute for 0. The
formatting then results in a number of the correct size, and tar correctly
handles it as an unknown user
Patch below
Nick
--- tarfile.py.orig 2003-08-10 03:17:21.000000000 +0100
+++ tarfile.py 2004-08-02 10:43:35.000000000 +0100
@@ -387,6 +387,14 @@
"""
# The following code was contributed by Detlef Lannert.
parts = []
+
+ # If self.uid or self.gid is -1, the tar file will be corrupted.
+ # therefore, we catch this, and chuck in a suitable looking value
+ if self.uid < 0:
+ self.uid = 0
+ if self.gid < 0:
+ self.gid = 0
+
for value, fieldsize in (
(self.name, 100),
("%07o" % self.mode, 8),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Duplicity-talk] Fix for corrupted archives with cygwin and python 2.3,
Nick Burch <=