-*- mode: org; epa-file-encrypt-to: ("isis@leap.se") -*-
#+TITLE:     python-gnupg audit
#+AUTHOR:    isis
#+EMAIL:     isis@leap.se
#+DATE:      2013-02-01 Fri
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:2 ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:   
#+LINK_HOME: 
#+XSLT:

* Development notes on patching python-gnupg

** python-gnupg

** Sphinx & documentation
*** Obtaining full .rst documentation from Sphinx

Internally, Sphinx prepares and uses ReStructed Text to create the other
formats, but provides no functionality for obtaining it. To steal it from
Sphinx, we can patch the Sphinx source to print it to stdout and then pipe that
to a file.

The patch for Sphinx is (from http://stackoverflow.com/a/2712413) changes
Sphinx's `sphinx.ext.autodoc.Documenter.add__line` function to:

#+BEGIN_SRC python
def add_line(self, line, source, *lineno):
    """Append one line of generated reST to the output."""
    print self.indent + line
    self.directive.result.append(self.indent + line, source, *lineno)))
#+END_SRC

* Resources

** On the ctb=%d.02 bug
This bug can be triggered in several versions of GnuPG, and will result in a 
message similar to:

gpg: [don't know]: invalid packet (ctb=2d)
gpg: [don't know]: invalid packet (ctb=2d)
gpg: keydb_search failed: invalid packet
gpg: encrypted with RSA key, ID ********
gpg: decryption failed: secret key not available

The 'ctb=2d' means that GnuPG has detected an extra '-' (0x2d) character,
except that this bug occurs (seemingly) at random during batch operations when
there is no extra '-'. (Or, at least, other files generated with similar
parameters and functions do not cause the 'invalid packet' error message to
appear.)

https://bugs.g10code.com/gnupg/issue1179
http://bugs.g10code.com/gnupg/issue997
