[Bps-public-commit] GnuPG-Interface branch, work-with-both-gnupgs, updated. 0.52-46-g743c5ba

Aaron Trevena ast at bestpractical.com
Tue May 5 10:13:46 EDT 2020


The branch, work-with-both-gnupgs has been updated
       via  743c5bada58ae0eb51b1012be37ca5ca1253f991 (commit)
       via  b90136b5e264167250ffa260b00b11ee043b1b0c (commit)
       via  c7230d7b88a30c9ad66b25bfd2292d0aa900badd (commit)
       via  75f84d26d4bc22c23a4f18286de0c7153d615b05 (commit)
      from  493862623848ae0393f737e89b2ad032daf681ce (commit)

Summary of changes:
 lib/GnuPG/Interface.pm |  7 ++++++-
 t/000_setup.t          | 23 +++++++++++------------
 t/MyTestSpecific.pm    |  6 +++---
 t/decrypt.t            |  1 +
 4 files changed, 21 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit 75f84d26d4bc22c23a4f18286de0c7153d615b05
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Tue May 5 14:42:36 2020 +0100

    Fix check for passing passphrase

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 889a12f..b9be5bb 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -100,7 +100,7 @@ sub wrap_call( $% ) {
     $self->passphrase("\n") unless $self->passphrase();
 
     my $needs_passphrase_handled
-        = ( $self->passphrase() and not $handles->passphrase() ) ? 1 : 0;
+        = ( $self->passphrase() =~ m/\S/ and not $handles->passphrase() ) ? 1 : 0;
 
     if ($needs_passphrase_handled) {
         $handles->passphrase( IO::Handle->new() );

commit c7230d7b88a30c9ad66b25bfd2292d0aa900badd
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Tue May 5 15:11:41 2020 +0100

    added debug logging options to synopsis in documentation

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index b9be5bb..4c39970 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -1203,6 +1203,11 @@ The following setup can be done before any of the following examples:
                               meta_interactive => 0 ,
                             );
 
+   $gnupg->options->debug_level(4);
+
+   $gnupg->options->logger_file("/tmp/gnupg-$$-decrypt-".time().".log");
+
+
 =head2 Encrypting
 
   # We'll let the standard error of GnuPG pass through

commit b90136b5e264167250ffa260b00b11ee043b1b0c
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Tue May 5 15:12:01 2020 +0100

    Updated test setup for gnupg-agent

diff --git a/t/000_setup.t b/t/000_setup.t
index 752eda0..1659b61 100644
--- a/t/000_setup.t
+++ b/t/000_setup.t
@@ -10,14 +10,13 @@ use Cwd;
 use File::Path qw (make_path);
 use File::Copy;
 
-# $gnupg->options->debug_level(4);
-# $gnupg->options->logger_file("/tmp/gnupg-$$-setup-".time().".log");
-
 TEST
 {
     my $homedir = $gnupg->options->homedir();
     make_path($homedir, { mode => 0700 });
 
+    copy('test/gpg.conf', $homedir . '/gpg.conf');
+
     if ($gnupg->cmp_version($gnupg->version, '2.2') >= 0 and $ENV{TEST_USE_GPG_AGENT}) {
         my $agentconf = IO::File->new( "> " . $homedir . "/gpg-agent.conf" );
         # Classic gpg can't use loopback pinentry programs like fake-pinentry.pl.
@@ -27,22 +26,22 @@ TEST
                 "pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n"
             );
         $agentconf->close();
-        copy('test/gpg.conf', $homedir . '/gpg.conf');
 
-        # In classic gpg, gpgconf cannot kill gpg-agent. But these tests
-        # will not start an agent when using classic gpg. For modern gpg,
-        # reset the state of any long-lived gpg-agent, ignoring errors:
-	$ENV{'GNUPGHOME'} = $homedir;
-	my $error = system('gpgconf', '--quiet', '--kill', 'gpg-agent', ' > /tmp/gpgconf.log  2> /tmp/gpgconf.error_log');
+        my $error = system("gpg-connect-agent", "--homedir", "$homedir", '/bye');
         if ($error) {
-            warn "gpgconf returned error : $error";
+            warn "gpg-connect-agent returned error : $error";
         }
-        $error = system('gpg-connect-agent', 'reloadagent', '/bye');
+
+        $error = system('gpg-connect-agent', "--homedir", "$homedir", 'reloadagent', '/bye');
         if ($error) {
             warn "gpg-connect-agent returned error : $error";
         }
 
-	delete $ENV{'GNUPGHOME'};
+        $error = system("gpg-agent", '--homedir', "$homedir");
+        if ($error) {
+            warn "gpg-agent returned error : $error";
+        }
+
     }
     reset_handles();
 
diff --git a/t/MyTestSpecific.pm b/t/MyTestSpecific.pm
index 32d2070..c335d62 100644
--- a/t/MyTestSpecific.pm
+++ b/t/MyTestSpecific.pm
@@ -39,9 +39,6 @@ use vars qw( @ISA           @EXPORT
               texts                  file_match
             );
 
-$gnupg = GnuPG::Interface->new( passphrase => 'test' );
-
-
 my $homedir;
 if (-f "test/gnupghome") {
   my $record = IO::File->new( "< test/gnupghome" );
@@ -54,6 +51,9 @@ if (-f "test/gnupghome") {
   $record->close();
 }
 
+$ENV{'GNUPGHOME'} = $homedir;
+
+$gnupg = GnuPG::Interface->new( passphrase => 'test' );
 $gnupg->options->hash_init( homedir              => $homedir,
                             armor                => 1,
                             meta_interactive     => 0,

commit 743c5bada58ae0eb51b1012be37ca5ca1253f991
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Tue May 5 15:12:39 2020 +0100

    fix passphrase clearing in decyption test

diff --git a/t/decrypt.t b/t/decrypt.t
index 0c7a596..ce8a884 100644
--- a/t/decrypt.t
+++ b/t/decrypt.t
@@ -73,6 +73,7 @@ TEST
     $handles->stdout( $texts{temp}->fh() );
     $handles->options( 'stdout' )->{direct} = 1;
 
+    $handles->clear_passphrase();
     $gnupg->clear_passphrase();
 
     my $pid = $gnupg->decrypt( handles => $handles );

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list