Skip Menu |

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

Report information
The Basics
Id: 71137
Status: resolved
Priority: 0/
Queue: GnuPG-Interface

People
Owner: Nobody in particular
Requestors: vm [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.44
Fixed in: (no value)



Subject: get_secret_keys(): Use of uninitialized value $expiration_date
get_secret_keys() warns on 'Use of uninitialized value $expiration_date' when it's processing a key which has no expiration date set. How to reproduce: 1. Create a test key pair, do not set expiry date: 'gpg --gen-key' 2. Test with script: ----- $ cat gnupg-test.pl #!/usr/bin/perl use strict; use warnings FATAL => qw(all); use GnuPG::Interface; my $gnupg = GnuPG::Interface->new; print $_->short_hex_id."\n" foreach ($gnupg->get_secret_keys); ----- Example test script run and key details from gpg: ----- $ ./gnupg-test.pl Use of uninitialized value $expiration_date in string eq at /usr/share/perl5/GnuPG/Interface.pm line 438, <GEN1> line 1. Use of uninitialized value $expiration_date in string eq at /usr/share/perl5/GnuPG/Interface.pm line 555, <GEN1> line 4. 81DDC625 $ gpg --list-secret-keys --with-colons --fixed-list-mode --with-fingerprint 81DDC625 sec::4096:1:5D1AFE8981DDC625:1274642370::::::scESC:::: fpr:::::::::5ED0356C51BE7242126F28705D1AFE8981DDC625: uid:::::1290146783::6AEE7A9CD5A744BC03551C641A0A0A509ED76735::Ville Mattila <vm@iki.fi>: ssb::4096:1:363AA660F50358AD:1274642370::::::e:::: ----- A (trivial) patch for http://search.cpan.org/src/JESSE/GnuPG-Interface-0.44/lib/GnuPG/Interface.pm is attached; fixes the problem for my specific case. Please note that the same code seems to appear also on line 483 of GnuPG/Interface.pm (signature and revocation processing?) - that might be broken, too? Environment: "This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi" "Linux liikkuva 2.6.38-11-generic #48-Ubuntu SMP Fri Jul 29 19:02:55 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux"
Subject: gnupg-interface-no-key-expiry-date.patch
--- GnuPG/Interface.pm.orig 2011-09-22 06:28:18.182124922 +0300 +++ GnuPG/Interface.pm 2011-09-22 06:28:14.982203738 +0300 @@ -435,7 +435,7 @@ # --fixed-list-mode uses epoch time for creation and expiration date strings. # For backward compatibility, we convert them back using GMT; my $expiration_date_string; - if ($expiration_date eq '') { + if (defined $expiration_date && $expiration_date eq '') { $expiration_date = undef; } else { $expiration_date_string = $self->_downrez_date($expiration_date); @@ -552,7 +552,7 @@ ) = @fields[ 1 .. 11 ]; my $expiration_date_string; - if ($expiration_date eq '') { + if (defined $expiration_date && $expiration_date eq '') { $expiration_date = undef; } else { $expiration_date_string = $self->_downrez_date($expiration_date);
From: vm [...] iki.fi
On Wed Sep 21 23:35:02 2011, vmattila wrote: Show quoted text
> A (trivial) patch for >
http://search.cpan.org/src/JESSE/GnuPG-Interface-0.44/lib/GnuPG/Interface.pm Show quoted text
> is attached; fixes the problem for my specific case. Please note that > the same code seems to appear also on line 483 of GnuPG/Interface.pm > (signature and revocation processing?) - that might be broken, too?
Please ignore the original patch. It does not fix the problem. The one attached to this message should be ok.
Subject: gnupg-interface-no-key-expiry-date-v2.patch
--- GnuPG/Interface.pm.orig 2011-09-22 06:28:18.182124922 +0300 +++ GnuPG/Interface.pm 2011-09-22 11:51:11.222152695 +0300 @@ -435,10 +435,12 @@ # --fixed-list-mode uses epoch time for creation and expiration date strings. # For backward compatibility, we convert them back using GMT; my $expiration_date_string; - if ($expiration_date eq '') { - $expiration_date = undef; - } else { - $expiration_date_string = $self->_downrez_date($expiration_date); + if (defined $expiration_date) { + if ($expiration_date eq '') { + $expiration_date = undef; + } else { + $expiration_date_string = $self->_downrez_date($expiration_date); + } } my $creation_date_string = $self->_downrez_date($creation_date); @@ -552,11 +554,13 @@ ) = @fields[ 1 .. 11 ]; my $expiration_date_string; - if ($expiration_date eq '') { - $expiration_date = undef; - } else { - $expiration_date_string = $self->_downrez_date($expiration_date); - } + if (defined $expiration_date) { + if ($expiration_date eq '') { + $expiration_date = undef; + } else { + $expiration_date_string = $self->_downrez_date($expiration_date); + } + } my $creation_date_string = $self->_downrez_date($creation_date); $current_signed_item = $current_key
Subject: Re: [rt.cpan.org #71137] get_secret_keys(): Use of uninitialized value $expiration_date
Date: Mon, 03 Oct 2011 14:33:41 -0400
To: bug-GnuPG-Interface [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
On Thu, 2011-09-22 at 04:55 -0400, Ville Mattila via RT wrote: Show quoted text
> Please ignore the original patch. It does not fix the problem. The one > attached to this message should be ok.
I've pushed commit 383a6a7 [1], which is a more general and correct fix for this problem, and removes the warnings from your test case. I'll release 0.45 with that change shortly. Thanks for the report, - Alex [1] https://github.com/bestpractical/gnupg-interface/commit/383a6a7