GnuPGInterface prints exit statuses incorrectly

Bug #333057 reported by Martin Pool on 2009-02-22
4
Affects Status Importance Assigned to Milestone
gnupginterface (Debian)
Fix Released
Unknown
gnupginterface (Ubuntu)
Medium
Unassigned

Bug Description

Binary package hint: python-gnupginterface

duplicity can produce a traceback like this:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 582, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 576, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 568, in main
    incremental_backup(sig_chain)
  File "/usr/bin/duplicity", line 272, in incremental_backup
    bytes_written = write_multivol("inc", tarblock_iter, globals.backend)
  File "/usr/bin/duplicity", line 151, in write_multivol
    at_end = gpg.GzipWriteFile(tarblock_iter, tdp.name, globals.volsize)
  File "/usr/lib/python2.5/site-packages/duplicity/gpg.py", line 290, in GzipWriteFile
    new_block = block_iter.next(bytes_to_go)
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 466, in next
    result = self.process(self.input_iter.next(), size)
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 176, in get_delta_iter
    for new_path, sig_path in collated:
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 261, in collate2iters
    relem2 = riter2.next()
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 322, in combine_path_iters
    range(len(path_iter_list))))
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 300, in get_triple
    path = path_iter_list[iter_index].next()
  File "/usr/lib/python2.5/site-packages/duplicity/diffdir.py", line 235, in sigtar2path_iter
    sigtarobj.close()
  File "/usr/lib/python2.5/site-packages/duplicity/dup_temp.py", line 118, in close
    assert not self.fileobj.close()
  File "/usr/lib/python2.5/site-packages/duplicity/gpg.py", line 162, in close
    self.gpg_process.wait()
  File "/var/lib/python-support/python2.5/GnuPGInterface.py", line 639, in wait
    raise IOError, "GnuPG exited non-zero, with code %d" % (e << 8)
IOError: GnuPG exited non-zero, with code 131072

Regardless of the underlying error, the raise statement in python-gnupginterface is bizarrely wrong. It's probably intended to be a >> to get just the exit code, but even then it would be much better to use os.WEXITSTATUS. However, since gnupg could well terminate other than because of exit(), it's probably simplest just to print the whole wait status and let people decode signals, exit statements or whatever.

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 9.04
Package: python-gnupginterface 0.3.2-9ubuntu1
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_AU.UTF-8
 SHELL=/bin/zsh
SourcePackage: gnupginterface
Uname: Linux 2.6.28-8-generic x86_64

Martin Pool (mbp) wrote :

This bug is reported and a patch supplied in Debian Bug report logs - #509415
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=509415

Duplicity backup depends on this module as well. When the correct shift is made, the error is 2, File Not Found, and refers to the non-existence of the ~/.gnupg directory and its necessary files. The workaround for this problem is to run gpg from the command line and let it create the files it needs, then GnuPGInterface will work correctly.

I've attached a patch that corrects this problem plus detabify's the source correctly. The source was a mess of tab size of 8 and indents of 4 which really screwed up editors that assumed tab size was the same as indent size.

Brian Murray (brian-murray) wrote :

Looking at the attachments in this bug report, I noticed that "Fix shit problem and detabify." was not flagged as a patch. A patch contains changes to an Ubuntu package that will resolve a bug and this attachment is one! Subsequently, I've checked the patch flag for it. In the future when submitting patches please use the patch checkbox as there are some Launchpad searches that use this feature. You can learn more about patch workflow at https://wiki.ubuntu.com/Bugs/Patches. Thanks for your contribution Kenneth Loafman!

Brian Murray (brian-murray) wrote :

Attached is a debdiff that will resolve the printing of exit statuses. I did not include the detab'ing as it seemed superfluous to be carrying as a patch.

Changed in gnupginterface (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnupginterface - 0.3.2-9ubuntu2

---------------
gnupginterface (0.3.2-9ubuntu2) jaunty; urgency=low

  * Add 01__print_exit_status_correctly.patch (Closes: #509415, LP: #333057)
    Thanks to Kenneth Loafman for the initial patch.

 -- Brian Murray <email address hidden> Tue, 31 Mar 2009 14:48:28 -0700

Changed in gnupginterface:
status: Triaged → Fix Released

I disagree with your assessment of the detab'ing. It was needed for
Eclipse's PyDev editor, and others, since the file had indent=4 and
tabsize=8. I had to detab in xemacs in order to get it to display
correctly in Eclipse without flagging indent errors.

Should I submit a different patch for this?

Brian Murray wrote:
> Attached is a debdiff that will resolve the printing of exit statuses.
> I did not include the detab'ing as it seemed superfluous to be carrying
> as a patch.
>
> ** Changed in: gnupginterface (Ubuntu)
> Importance: Undecided => Medium
>
> ** Changed in: gnupginterface (Ubuntu)
> Status: New => Triaged
>
> ** Attachment added: "gnupginterface_0.3.2-9ubuntu2.debdiff"
> http://launchpadlibrarian.net/24593092/gnupginterface_0.3.2-9ubuntu2.debdiff
>

Changed in gnupginterface (Debian):
status: Unknown → New
Changed in gnupginterface (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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