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

Brian Duggan brian at bestpractical.com
Fri Apr 6 10:39:55 EDT 2018


The branch, work-with-both-gnupgs has been updated
       via  f00ea4432c07a95fd5aac062bb56f7224e126584 (commit)
       via  a387dcaa15ff34b84afdafa55347f0c045f89afc (commit)
       via  44f5b98ad39972ccddbbabd8894f815babf817fc (commit)
      from  b6762c9f39a977bfe1e1cf99d29708494d71f7ab (commit)

Summary of changes:
 lib/GnuPG/Interface.pm                       | 10 ++++++----
 t/000_setup.t                                |  5 ++++-
 t/list_secret_keys.t                         | 16 +++++++++++++---
 test/secret-keys/1.1.test                    | 11 +++++++++++
 test/secret-keys/{1.modern.test => 1.2.test} |  0
 5 files changed, 34 insertions(+), 8 deletions(-)
 create mode 100644 test/secret-keys/1.1.test
 rename test/secret-keys/{1.modern.test => 1.2.test} (100%)

- Log -----------------------------------------------------------------
commit 44f5b98ad39972ccddbbabd8894f815babf817fc
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Wed Mar 28 13:44:38 2018 -0400

    Update secret key lists and test for early versions of gpg 2.1.x
    
    At least as of gpg 2.1.11, gpg --list-secret-keys did not include the
    key fingerprint by default. This change adds a new secret key list to
    compare against in the test. It also migrates the key list versioning to
    a numbering scheme instead of using GnuPG branch names, like 'modern'.

diff --git a/t/list_secret_keys.t b/t/list_secret_keys.t
index 52f698f..13a7ae2 100644
--- a/t/list_secret_keys.t
+++ b/t/list_secret_keys.t
@@ -44,9 +44,19 @@ TEST
 
 TEST
 {
-    my $branch = $gnupg->cmp_version($gnupg->version, '2.1') >= 0 ? 'modern' : '0';
-    print $branch."\n";
-    my @files_to_test = ( 'test/secret-keys/1.'.$branch.'.test' );
+    my $keylist;
+    if ($gnupg->cmp_version($gnupg->version, '2.1') < 0) {
+	$keylist = '0';
+    }
+    else {
+	if ($gnupg->cmp_version($gnupg->version, '2.1.11') <= 0) {
+	    $keylist = '1';
+	}
+	else {
+	    $keylist = '2';
+	}
+    }
+    my @files_to_test = ( 'test/secret-keys/1.'.$keylist.'.test' );
 
     return file_match( $outfile, @files_to_test );
 };
diff --git a/test/secret-keys/1.1.test b/test/secret-keys/1.1.test
new file mode 100644
index 0000000..2fa6ceb
--- /dev/null
+++ b/test/secret-keys/1.1.test
@@ -0,0 +1,11 @@
+test/gnupghome/pubring.kbx
+--------------------------
+sec   dsa1024/F950DA9C 2000-02-06 [SCA]
+uid         [ unknown] GnuPG test key (for testing purposes only)
+uid         [ unknown] Foo Bar (1)
+ssb   elg768/2E854A6B 2000-02-06 [E]
+
+sec   rsa2048/B6747DDC 2016-10-12 [SC]
+uid         [ unknown] GnuPG::Interface Test key <test at example.org>
+ssb   rsa2048/AE441D0F 2016-10-12 [E]
+
diff --git a/test/secret-keys/1.modern.test b/test/secret-keys/1.2.test
similarity index 100%
rename from test/secret-keys/1.modern.test
rename to test/secret-keys/1.2.test

commit a387dcaa15ff34b84afdafa55347f0c045f89afc
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Wed Mar 28 14:22:01 2018 -0400

    Pass --homdir in encrypt_symmetrically for GnuPG >= 2.1.0
    
    GnuPG::Interface::ecnrypt_symmetrically cleared the --homedir option
    since version 2.0.x fails symmetric encryption when it is passed. This
    change does not clear the --homdir option for GnuPG >= 2.1.0.

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index afd68c8..7316af3 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -695,15 +695,17 @@ sub encrypt( $% ) {
 
 sub encrypt_symmetrically( $% ) {
     my ( $self, %args ) = @_;
-    # Strip the homedir and put it back after encrypting; gpg 2.0.x
-    # fails symmetric encryption when one is passed.
+    # Strip the homedir and put it back after encrypting; gpg > 2.0.0
+    # and < 2.1.0 fail symmetric encryption when one is passed.
     my $homedir = $self->options->homedir;
-    $self->options->clear_homedir;
+    $self->options->clear_homedir
+        unless $self->cmp_version($self->version, '2.1') >= 0;
     my $pid = $self->wrap_call(
         %args,
         commands => ['--symmetric']
     );
-    $self->options->homedir($homedir);
+    $self->options->homedir($homedir)
+        unless $self->cmp_version($self->version, '2.1') >= 0;
     return $pid;
 }
 

commit f00ea4432c07a95fd5aac062bb56f7224e126584
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Wed Mar 28 15:29:57 2018 -0400

    Set allow-loopback-pinentry for gpg-agent in test homedirs
    
    Early versions of GnuPG 2.1.x did not allow loopback pinentry by
    default. Some tests test this functionality for GnuPG 2.1.x. This
    change explicitly enables loopback pinentry for all 2.1.x versions.

diff --git a/t/000_setup.t b/t/000_setup.t
index e1ffcf1..b336427 100644
--- a/t/000_setup.t
+++ b/t/000_setup.t
@@ -16,7 +16,10 @@ TEST
     make_path($homedir, { mode => 0700 });
     my $agentconf = IO::File->new( "> " . $homedir . "/gpg-agent.conf" );
     # Classic gpg can't use loopback pinentry programs like fake-pinentry.pl.
-    $agentconf->write("pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n") if $gnupg->cmp_version($gnupg->version, '2.1') >= 0;
+    $agentconf->write(
+	"allow-loopback-pinentry\n".
+	"pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n"
+    ) if $gnupg->cmp_version($gnupg->version, '2.1') >= 0;
     $agentconf->close();
     copy('test/gpg.conf', $homedir . '/gpg.conf');
     # In classic gpg, gpgconf cannot kill gpg-agent. But these tests

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


More information about the Bps-public-commit mailing list