duplicity-talk
[Top][All Lists]
Advanced

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

[Duplicity-talk] duplicity fails on gids/uids > 2097151


From: asdf
Subject: [Duplicity-talk] duplicity fails on gids/uids > 2097151
Date: Sun, 21 Aug 2005 22:25:19 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.0)

I stumbled over a bug in duplicity where files with uids/gids greater than
2097151 (that's 7777777 in octal) will lead to corrupt backup files. Incidently
there was a file with gid 4294967295 on my fs. When trying to restore the
created backup-set Duplicity failed, saying:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 358, in ?
    if __name__ == "__main__": main()
  File "/usr/bin/duplicity", line 352, in main
    else: incremental_backup(sig_chain)
  File "/usr/bin/duplicity", line 162, in incremental_backup
    bytes_written = write_multivol("inc", tarblock_iter, globals.backend)
  File "/usr/bin/duplicity", line 75, in write_multivol
    globals.gpg_profile)
  File "/usr/lib/python2.3/site-packages/duplicity/gpg.py", line 211, in
GPGWriteFile
    try: data = block_iter.next(bytes_to_go).data
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 407, in
next
    result = self.process(self.input_iter.next(), size)
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 261, in
get_delta_iter_w_sig
    for new_path, sig_path in collated:
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 177, in
collate2iters
    try: relem2 = riter2.next()
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 230, in
combine_path_iters
    range(len(path_iter_list))))
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 211, in
get_triple
    try: path = path_iter_list[iter_index].next()
  File "/usr/lib/python2.3/site-packages/duplicity/diffdir.py", line 153, in
sigtar2path_iter
    ropath.init_from_tarinfo(tarinfo)
  File "/usr/lib/python2.3/site-packages/duplicity/path.py", line 171, in
init_from_tarinfo
    else: raise PathException("Unknown tarinfo type %s" % (type,))
duplicity.path.PathException: Unknown tarinfo type

And, as I later noticed, when creating the archive there was a Warning:
/usr/lib/python2.3/site-packages/duplicity/tarfile.py:390: FutureWarning:
%u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up

As I tried to manually extract the archive with tar, it said something about
"unexpected end of file".

The problem is, that tar files created by tarfile.py can only store uids/gids up
to 2097151, so I created a patch that sets uids/gids which are too high to
60001. This is rather a hack and since I'm new to duplicity and python someone
more experienced should have a look at this problem.

--- tarfile.py.org      2005-08-21 19:14:11.000000000 +0200
+++ tarfile.py  2005-08-21 21:40:23.000000000 +0200
@@ -385,6 +385,12 @@
     def getheader(self):
         """Return a tar header block as a 512 byte string.
         """
+        if self.uid > 2097151 or self.uid < 0:
+            sys.stderr.write("uid %i of file %s not in range. Setting uid to
60001\n" % (self.uid,self.name))
+            self.uid = 60001
+        if self.gid > 2097151 or self.gid < 0:
+            sys.stderr.write("gid %i of file %s not in range. Setting gid to
60001\n" % (self.gid, self.name))
+            self.gid = 60001
         # The following code was contributed by Detlef Lannert.
         parts = []
         for value, fieldsize in (




reply via email to

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