duplicity.gpg.gpg_failed() breaks and spews on GnuPG error

Bug #405975 reported by Larry Gilbert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

It looks like r570 introduced a bug in how GnuPG error messages are reported back to the user. (At least it breaks in Python 2.5.1, which is what I'm using.)

It looks like the block beginning with "for line in self.logger_fp, self.stderr_fp:" is not working as expected. At some point the "line" variable ends up containing a file object. I *think* what's happening is that when logger_fp is done iterating, the next thing returned is stderr_fp--the object itself.

I am not a Python adept, so the best way I could figure to make it do what's intended is to split the block into twin blocks, one for logger_fp and one for stderr_fp. Seems like there ought to be a better way to do that. But it fixes the bug for me.

Here is an example of the bug output, and I will attach a merge bundle for my fix in a minute.

Traceback (most recent call last):
  File "./duplicity-bin", line 1238, in <module>
    with_tempdir(main)
  File "./duplicity-bin", line 1231, in with_tempdir
    fn()
  File "./duplicity-bin", line 1187, in main
    verify(col_stats)
  File "./duplicity-bin", line 660, in verify
    for backup_ropath, current_path in collated:
  File "/home/larry/work/duplicity/mytrunk/duplicity/diffdir.py", line 270, in collate2iters
    relem1 = riter1.next()
  File "/home/larry/work/duplicity/mytrunk/duplicity/patchdir.py", line 491, in integrate_patch_iters
    for patch_seq in collated:
  File "/home/larry/work/duplicity/mytrunk/duplicity/diffdir.py", line 274, in collate2iters
    for relem2 in riter2:
  File "/home/larry/work/duplicity/mytrunk/duplicity/patchdir.py", line 110, in difftar2path_iter
    tarinfo_list = [tar_iter.next()]
  File "/home/larry/work/duplicity/mytrunk/duplicity/patchdir.py", line 331, in next
    self.set_tarfile()
  File "/home/larry/work/duplicity/mytrunk/duplicity/patchdir.py", line 319, in set_tarfile
    assert not self.current_fp.close()
  File "/home/larry/work/duplicity/mytrunk/duplicity/dup_temp.py", line 210, in close
    assert not self.fileobj.close()
  File "/home/larry/work/duplicity/mytrunk/duplicity/gpg.py", line 201, in close
    self.gpg_failed()
  File "/home/larry/work/duplicity/mytrunk/duplicity/gpg.py", line 165, in gpg_failed
    msg += line.strip() + "\n"
AttributeError: 'file' object has no attribute 'strip'

Revision history for this message
Larry Gilbert (l2g) wrote :
Larry Gilbert (l2g)
description: updated
Revision history for this message
Larry Gilbert (l2g) wrote :

I think I *did* find a better way!

Changed in duplicity:
importance: Undecided → Medium
status: New → Fix Committed
Changed in duplicity:
milestone: none → 0.6.03
Changed in duplicity:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.