Skip Menu |

This queue is for tickets about the Mail-GnuPG CPAN distribution.

Report information
The Basics
Id: 93797
Status: resolved
Priority: 0/
Queue: Mail-GnuPG

People
Owner: Nobody in particular
Requestors: MCARDWELL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.19
Fixed in: (no value)



Subject: _rebuild_key_cache has started failing hard. Patch included.
In "sub _rebuild_key_cache", $key->user_ids is expected to return a list of user ids, and it did. Until I just did a dist-upgrade on my Debian system. Then all of a sudden "has_public_key" started to fail, because "$key->user_ids" started returning a list of array refs instead. If fixed this, in what should be a backwards compatible manner with the following patch: ******************************************************************************** --- 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'm not sure what exactly changed during the upgrade to trigger this problem, although I'm guessing it's GnuPG::Interface. I'm running: Mail::GnuPG v0.19 GnuPG v2.0.22 GnuPG::Interface v0.48
For a bit more info, when debugging this. Immediately after the following line in Mail::GnuPG: "foreach my $uid ($key->user_ids) {" I added the line: "use Data::Dumper; print Dumper($uid)" And the output was (slightly obfuscated to protect my email addresses): $VAR1 = [ bless( { 'validity' => 'u', 'signatures' => [], 'as_string' => 'Mike Cardwell <mike.cardwell@example.com>', 'revocations' => [] }, 'GnuPG::UserId' ), bless( { 'revocations' => [], 'as_string' => 'Mike Cardwell <mike.cardwell@example.org>', 'signatures' => [], 'validity' => 'u' }, 'GnuPG::UserId' ), ];
FYI, I have also reported this as a bug with GnuPG::Interface https://rt.cpan.org/Ticket/Display.html?id=93826
this seems to have been resolved in GnuPG::Interface. Feel free to re-open if this is wrong.