** Also affects: duplicity (Ubuntu Precise)
   Importance: Undecided
       Status: New

** Also affects: duplicity (Ubuntu Quantal)
   Importance: Undecided
       Status: New

** Also affects: duplicity (Ubuntu Raring)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to duplicity in Ubuntu.
https://bugs.launchpad.net/bugs/1216921

Title:
  util.ignore_missing() does not work

Status in Duplicity - Bandwidth Efficient Encrypted Backup:
  Confirmed
Status in “duplicity” package in Ubuntu:
  Triaged
Status in “duplicity” source package in Precise:
  Triaged
Status in “duplicity” source package in Quantal:
  Triaged
Status in “duplicity” source package in Raring:
  Triaged

Bug description:
  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

To manage notifications about this bug go to:
https://bugs.launchpad.net/duplicity/+bug/1216921/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to