[Bps-public-commit] GnuPG-Interface branch, fix-delete-secret-key-for-2.2, created. 1.01-2-g7ccb3c3

? sunnavy sunnavy at bestpractical.com
Mon Mar 29 14:51:09 EDT 2021


The branch, fix-delete-secret-key-for-2.2 has been created
        at  7ccb3c3de72d2afb2b808c994c3135c8be19d1a9 (commit)

- Log -----------------------------------------------------------------
commit aab68b2cdb2da3a56f3367cb98bc7c0a388491e2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 30 01:09:26 2021 +0800

    Fix the issue of deleting secret key comamnds in gpg 2.2
    
    See also https://dev.gnupg.org/T4667

diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 13b313e..1324c07 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -336,6 +336,13 @@ sub fork_attach_exec( $% ) {
         }
 
         my @args = $self->options->get_args();
+
+        # Get around a bug in 2.2, see also https://dev.gnupg.org/T4667
+        # this covers both --delete-secret-key(s) and --delete-secret-and-public-key(s)
+        if ( $self->version && $self->cmp_version( $self->version, 2.2 ) >= 0 && $commands[0] =~ /^--delete-secret-.*keys?$/ ) {
+            push @args, '--yes';
+        }
+
         push @args, '--pinentry-mode', 'loopback'
           if $use_loopback_pinentry;
 

commit 7ccb3c3de72d2afb2b808c994c3135c8be19d1a9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 30 02:21:00 2021 +0800

    Test delete keys

diff --git a/t/z_delete_keys.t b/t/z_delete_keys.t
new file mode 100644
index 0000000..b5d1215
--- /dev/null
+++ b/t/z_delete_keys.t
@@ -0,0 +1,51 @@
+use strict;
+use English qw( -no_match_vars );
+
+use lib './t';
+use MyTest;
+use MyTestSpecific;
+
+TEST
+{
+    reset_handles();
+
+    my $pid = $gnupg->wrap_call(
+        gnupg_commands     => [qw( --delete-secret-keys )],
+        gnupg_command_args => [qw( 0x93AFC4B1B0288A104996B44253AE596EF950DA9C )],
+        handles            => $handles,
+    );
+
+    waitpid $pid, 0;
+
+    return $CHILD_ERROR == 0;
+};
+
+TEST
+{
+    reset_handles();
+
+    my $pid = $gnupg->wrap_call(
+        gnupg_commands     => [qw( --delete-keys )],
+        gnupg_command_args => [qw( 0x93AFC4B1B0288A104996B44253AE596EF950DA9C )],
+        handles            => $handles,
+    );
+
+    waitpid $pid, 0;
+
+    return $CHILD_ERROR == 0;
+};
+
+TEST
+{
+    reset_handles();
+
+    my $pid = $gnupg->wrap_call(
+        gnupg_commands     => [qw( --delete-secret-and-public-keys )],
+        gnupg_command_args => [qw( 278F850AA702911F1318F0A61B913CE9B6747DDC )],
+        handles            => $handles,
+    );
+
+    waitpid $pid, 0;
+
+    return $CHILD_ERROR == 0;
+};

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


More information about the Bps-public-commit mailing list