Grepular

GPGIT Broken by Breaking Change in GnuPG::Interface

Written 4 years ago by Mike Cardwell

I know a number of you use some code which I wrote (gpgit) for automatically encrypting your incoming email with your public PGP key. I just did a dist-upgrade on my mail server, (a Debian Testing box) and it broke hard. One of the modules it uses is Mail::GnuPG. Mail::GnuPG uses GnuPG::Interface. Doing the dist-upgrade, upgraded GnuPG::Interface from version 0.46 to 0.48. Unfortunately, a change in 0.48 (or perhaps 0.47) has broken Mail::GnuPG, and in turn, gpgit.

If you’re going to upgrade, apply the following patch to your systems Mail/GnuPG.pm file first:

--- GnuPG.pm.ORIG       2014-03-12 17:07:52.209701232 +0000
+++ GnuPG.pm    2014-03-12 17:11:22.161473944 +0000
@@ -478,10 +478,12 @@
   $self->_set_options($gnupg);
   my @keys = $gnupg->get_public_keys();
   foreach my $key (@keys) {
-    foreach my $uid ($key->user_ids) {
-      # M::A may not parse the gpg stuff properly.  Cross fingers
-      my ($a) = Mail::Address->parse($uid->as_string); # list context, please
-      $key_cache{$a->address}=1 if ref $a;
+    foreach ($key->user_ids) { 
+      foreach my $uid (ref($_) eq 'ARRAY' ? @$_ : ($_)) {
+        # M::A may not parse the gpg stuff properly.  Cross fingers
+        my ($a) = Mail::Address->parse($uid->as_string); # list context, please
+        $key_cache{$a->address}=1 if ref $a;
+      }
     }
   }
 }

I’ve reported this as a critical bug to both the Mail::GnuPG and GnuPG::Interface packagers: https://rt.cpan.org/Ticket/Display.html?id=93797 https://rt.cpan.org/Ticket/Display.html?id=93826 I’m hoping it gets fixed in GnuPG::Interface as that seems to be being actively developed whereas Mail::GnuPG isn’t.

Want to leave a tip?BitcoinMoneroZcashPaypalYou can follow this Blog using RSS or . To read more, visit my blog index.