This is a wishlist request to provide more meaningful error return codes instead
of the catch-all "2". As mentioned in other bug reports, GnuPG currently does
not indicate severity or even class of error by its return code. For scripting
environments, this requires the developer to parse and interpret the stderr
messages to figure out how bad things really are. It would be far more
expedient and robust for these environments if gnupg and friends would actually
give more meaningful returns.
For example, I have been trying to use the gnupg.vim script for
encrypting/decrypting files in vim itself. It turns out that one of the files
had been tampered with in one form or another, but not so much as to prevent the
document from being able to be decrypted. The author of the gnupg.vim script
made a reasonable assumption, that if the decryption call to gpg exited with an
error, than the message could not be decrypted -- or flawed and should not be
worked on. Although it was valuable to know that the file had been meddled
with, it was not helpful not to be prevented from working on or salvaging the
file. Had gpg had more sane and meaningful return values, this error in
scripting may not have happened, the author would have more flexibility on how
his script were to act when presented with an error condition. It is evident
that the author of the script didn't consider this, and the error lies in his
court. However, I consider this a design flaw on gnupg's part and would love to
see it remedied.