You have been subscribed to a public bug:

duplicity version: 0.6.18-0ubuntu3 
python version: 2.7.3
Distro: ubuntu precise 12.04
target file system: ftp

I happen to encounter failed backups with tracebacks like this:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1403, in <module>
     with_tempdir(main)
  File "/usr/bin/duplicity", line 1396, in with_tempdir
     fn()
   File "/usr/bin/duplicity", line 1366, in main
     full_backup(col_stats)
   File "/usr/bin/duplicity", line 504, in full_backup
     sig_outfp.to_remote()
   File "/usr/lib/python2.7/dist-packages/duplicity/dup_temp.py", line 184, in 
to_remote
     globals.backend.move(tgt) #@UndefinedVariable
   File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 364, in 
move
     source_path.delete()
   File "/usr/lib/python2.7/dist-packages/duplicity/path.py", line 567, in 
delete
     util.ignore_missing(os.unlink, self.name)
   File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 116, in 
ignore_missing
     fn(filename)
 OSError: [Errno 2] No such file or directory: 
'/BACKUP/.duplycache/duply_foo/duplicity-full-signatures.20130825T140002Z.sigtar.gpg'

Now running test code like

#!/usr/bin/env python
#
# Do what util.ignore_missing(os.unlink, self.name) tries to do and
# fails to achieve

import os
import sys
import errno

if __name__ == "__main__":
        try:
                os.unlink("/tmp/doesnotexist")
        except Exception:
                # "type" is a reserved keyword, replaced with "mytype"
                mytype, value, tb = sys.exc_info()
                print "-" * 78
                print "mytype: ", mytype
                print "value: ", value
                print "value[0]:", value[0]
                print "errno.ENOENT: ", errno.ENOENT
                print "isinstance(mytype, OSError): ", isinstance(mytype, 
OSError)
                print "-" * 78
                if isinstance(mytype, OSError) and value[0] == errno.ENOENT:
                        print "Gotcha!"
                        pass
                print "Ooops, missed it ..."
                raise

will always raise the exception and not ignore it, because
isinstance(mytype, OSError) is always False.

What I expect ignore_missing to look like is:

def ignore_missing(fn, filename):
    """
    Execute fn on filename.  Ignore ENOENT errors, otherwise raise exception.

    @param fn: callable
    @param filename: string
    """
    try:
        fn(filename)
    except OSError, ex:
        if ex.errno == errno.ENOENT:
            pass
        else:
            raise
    else:
        raise

** Affects: duplicity (Ubuntu)
     Importance: Undecided
     Assignee: Louis Bouchard (louis-bouchard)
         Status: In Progress

-- 
util.ignore_missing() does not work
https://bugs.launchpad.net/bugs/1216921
You received this bug notification because you are a member of Ubuntu Bugs, 
which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to