Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: corsepiu [...] fedoraproject.org
Cc:
AdminCc:

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



Subject: t/agent.t fails with GnuPG::Interface > 0.45
Date: Wed, 20 Feb 2013 08:20:54 +0100
To: bug-Mail-GnuPG [...] rt.cpan.org
From: Ralf Corsépius <corsepiu [...] fedoraproject.org>
Hi, Mail-GnuPG-0.18's testsuite fails with GnuPG::Interface > 0.45: t/00.signature.t ......... skipped: Set the environment variable TEST_SIGNATURE to enable this test. t/05.load.t .............. ok t/20.inline-verify.t ..... ok t/25.multipart-verify.t .. ok t/30.inline-decrypt.t .... ok t/35.has-public-key.t .... ok t/99.pod.t ............... ok t/agent.t ................ 1/? # Failed test at t/agent.t line 78. # got: '0' # expected: '2' # Failed test at t/agent.t line 81. # got: '0' # expected: '2' # Failed test at t/agent.t line 82. # got: 'EFEA4EAD' # expected: undef # Failed test at t/agent.t line 83. # got: 'Mail::GnuPG Test Key <mail@gnupg.dom>' # expected: undef # Failed test at t/agent.t line 92. # got: '0' # expected: '2' Unknown Content-Type or no PGP message in body at /builddir/build/BUILD/Mail-GnuPG-0.18/blib/lib/Mail/GnuPG.pm line 402. # Looks like you planned 20 tests but ran 8. # Looks like you failed 5 tests of 8 run. # Looks like your test exited with 2 just after 8. t/agent.t ................ Dubious, test returned 2 (wstat 512, 0x200) Failed 17/20 subtests t/base.t ................. ok t/round-trip.t ........... ok The test-suite completes without complaints with GnuPG::Interface-0.44 or 0.45. As things appear to me, something has changed in GnuPG::Interface-0.46, which actually breaks Mail::GnuPG or at least Mail::GnuPG's t/agent.t. Ralf
Subject: Re: [rt.cpan.org #83465] GnuPG::Interface > 0.45 breaks Mail::GnuPG-0.18 's t/agent.t
Date: Wed, 20 Feb 2013 00:36:07 -0800
To: bug-Mail-GnuPG [...] rt.cpan.org
From: Thomas Sibley <tsibley [...] cpan.org>
On 02/19/2013 11:32 PM, Ralf Corsépius via RT wrote: Show quoted text
> As things appear to me, something has changed in GnuPG::Interface-0.46, > which actually breaks Mail::GnuPG or at least Mail::GnuPG's t/agent.t.
Before 0.46, the strict separation of command arguments and options was not enforced [1]. This change, which quite unfortunately missed being included in the ChangeLog for 0.46, appears to be the culprit. Mail::GnuPG should be updated to correctly use ->options instead of passing command_args. Refer to the SYNOPSIS [2] and the first paragraph explaining the various actions/methods available [3]. [1] https://github.com/bestpractical/gnupg-interface/commit/c072c82 [2] https://metacpan.org/module/GnuPG::Interface#SYNOPSIS [3] https://metacpan.org/module/GnuPG::Interface#search_keys
Subject: Re: [rt.cpan.org #83465] GnuPG::Interface > 0.45 breaks Mail::GnuPG-0.18 's t/agent.t
Date: Thu, 02 May 2013 08:15:40 -0300
To: bug-Mail-GnuPG [...] rt.cpan.org
From: David Bremner <david [...] tethera.net>
Thomas Sibley via RT <bug-Mail-GnuPG@rt.cpan.org> writes: Show quoted text
> Mail::GnuPG should be updated to correctly use ->options instead of > passing command_args. Refer to the SYNOPSIS [2] and the first paragraph > explaining the various actions/methods available [3].
[...] Show quoted text
"To understand what are options and what are command arguments please read [Dead Link 1] and [Dead Link 2]." Oops ;). Anyway, attached is a proposed fix. Any comments?
From 3c3ef567bd1d026e0eb92d349012f93d35addc22 Mon Sep 17 00:00:00 2001 From: David Bremner <bremner@unb.ca> Date: Thu, 2 May 2013 08:06:01 -0300 Subject: [PATCH] pass use agent as an option rather than as an argument. This should be a fix for [rt.cpan.org #83465]. The three line addition to _set_options is the main functional change. --- lib/Mail/GnuPG.pm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/Mail/GnuPG.pm b/lib/Mail/GnuPG.pm index 22319d1..906f985 100644 --- a/lib/Mail/GnuPG.pm +++ b/lib/Mail/GnuPG.pm @@ -79,6 +79,9 @@ sub _set_options { # ( defined $self->{passphrase} ? # ( passphrase => $self->{passphrase} ) : () ), ); + if ($self->{use_agent}) { + push @{$gnupg->options->extra_args}, '--use-agent'; + } if (defined $self->{always_trust}) { $gnupg->options->always_trust($self->{always_trust}) @@ -120,11 +123,6 @@ sub _set_options { =cut -sub _agent_args{ - my $self=shift; - return $self->{use_agent} ? ('command_args' => ['--use-agent']) : (); -} - sub decrypt { my ($self, $message) = @_; my $ciphertext = ""; @@ -172,7 +170,7 @@ sub decrypt { ); # this sets up the communication - my $pid = $gnupg->decrypt( handles => $handles , $self->_agent_args ); + my $pid = $gnupg->decrypt( handles => $handles ); die "NO PASSPHRASE" unless defined $passphrase_fh; my $read = _communicate([$output, $error, $status_fh], @@ -560,7 +558,7 @@ sub mime_sign { passphrase => $passphrase_fh, status => $status_fh, ); - my $pid = $gnupg->detach_sign( handles => $handles, $self->_agent_args ); + my $pid = $gnupg->detach_sign( handles => $handles ); die "NO PASSPHRASE" unless defined $passphrase_fh; # this passes in the plaintext @@ -659,7 +657,7 @@ sub clear_sign { stderr => $error, ); - my $pid = $gnupg->clearsign ( handles => $handles, $self->_agent_args ); + my $pid = $gnupg->clearsign ( handles => $handles ); my $plaintext = $body->as_string; @@ -762,7 +760,7 @@ sub _ascii_encrypt { my $pid = do { if ( $sign ) { - $gnupg->sign_and_encrypt ( handles => $handles, $self->_agent_args ); + $gnupg->sign_and_encrypt ( handles => $handles ); } else { $gnupg->encrypt ( handles => $handles ); } @@ -862,7 +860,7 @@ sub _mime_encrypt { my $pid = do { if ($sign) { - $gnupg->sign_and_encrypt( handles => $handles, $self->_agent_args ); + $gnupg->sign_and_encrypt( handles => $handles ); } else { $gnupg->encrypt( handles => $handles ); } -- 1.8.2.rc2
this fix was indeed applied in 0.19