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

Brian Duggan brian at bestpractical.com
Thu May 3 17:37:00 EDT 2018


The branch, work-with-both-gnupgs has been updated
       via  7f5c845cd4ba52a7a04d25f634b0766495a70bba (commit)
       via  91ba04df1325594f41ee65e3354c8ebcad6dae05 (commit)
      from  f00ea4432c07a95fd5aac062bb56f7224e126584 (commit)

Summary of changes:
 lib/GnuPG/Interface.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 91ba04df1325594f41ee65e3354c8ebcad6dae05
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Thu May 3 16:22:23 2018 -0400

    Always print newline for empty passphrases
    
    GnuPG 2.1+ needs empty passphrases to be terminated with a newline. This
    change substitutes a newline character for empty passphrases.

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 7316af3..fa2415a 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -99,17 +99,18 @@ sub wrap_call( $% ) {
     $handles->stdout('>&STDOUT') unless $handles->stdout();
     $handles->stderr('>&STDERR') unless $handles->stderr();
 
-    # so call me sexist; English just doen't cope well
-    my $needs_passphrase_handled_for_him
+    $self->passphrase("\n") unless $self->passphrase();
+
+    my $needs_passphrase_handled
         = ( $self->passphrase() and not $handles->passphrase() ) ? 1 : 0;
 
-    if ($needs_passphrase_handled_for_him) {
+    if ($needs_passphrase_handled) {
         $handles->passphrase( IO::Handle->new() );
     }
 
     my $pid = $self->fork_attach_exec(%args);
 
-    if ($needs_passphrase_handled_for_him) {
+    if ($needs_passphrase_handled) {
         my $passphrase_handle = $handles->passphrase();
         print $passphrase_handle $self->passphrase();
         close $passphrase_handle;

commit 7f5c845cd4ba52a7a04d25f634b0766495a70bba
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Thu May 3 17:28:17 2018 -0400

    Use --no-options for GnuPG::Interface::version()
    
    Without passing --no-options, any invocation of gpg will use the default
    homedir and its config files. While --version should never make any
    changes to the homedir, this can still cause issues when switching
    between gpg versions. For example, if the user has gpg 2.1.x-specific
    config lines in gpg.conf, then running GnuPG::Interface::version() with
    gpg 1.4.x will throw warnings.

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index fa2415a..d433392 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -806,7 +806,7 @@ sub _version {
 
     my $out = IO::Handle->new;
     my $handles = GnuPG::Handles->new( stdout => $out );
-    $self->wrap_call( commands => [ '--version' ], handles => $handles );
+    $self->wrap_call( commands => [ '--no-options', '--version' ], handles => $handles );
     my $line = $out->getline;
     $line =~ /(\d+\.\d+\.\d+)/;
     return $1;

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


More information about the Bps-public-commit mailing list