This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=e490f8ff7b4e9657c65ee4b144246669ce22bf0b

commit e490f8ff7b4e9657c65ee4b144246669ce22bf0b
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Oct 27 03:09:35 2022 +0200

    Dpkg::OpenPGP: Move status check from _gpg_exec() to _gpg_verify()
    
    The conditional is specific to signature verification. This way this
    helper will be usable also for other backend invocations.
---
 scripts/Dpkg/OpenPGP.pm | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/scripts/Dpkg/OpenPGP.pm b/scripts/Dpkg/OpenPGP.pm
index c1723cb35..4a227a0ab 100644
--- a/scripts/Dpkg/OpenPGP.pm
+++ b/scripts/Dpkg/OpenPGP.pm
@@ -140,7 +140,7 @@ sub dearmor {
 
 sub _gpg_exec
 {
-    my ($opts, $exec, $errmsg) = @_;
+    my ($opts, $exec) = @_;
 
     my ($stdout, $stderr);
     spawn(exec => $exec, wait_child => 1, nocheck => 1, timeout => 10,
@@ -148,11 +148,7 @@ sub _gpg_exec
     if (WIFEXITED($?)) {
         my $status = WEXITSTATUS($?);
         print { *STDERR } "$stdout$stderr" if $status;
-        if ($status == 1 or ($status && $opts->{require_valid_signature})) {
-            error($errmsg);
-        } elsif ($status) {
-            warning($errmsg);
-        }
+        return $status;
     } else {
         subprocerr("@{$exec}");
     }
@@ -187,8 +183,14 @@ sub _gpg_verify {
     push @exec, $sig if defined $sig;
     push @exec, $data;
 
-    my $errmsg = sprintf g_('cannot verify signature for %s'), $data;
-    _gpg_exec($opts, \@exec, $errmsg);
+    my $status = _gpg_exec($opts, \@exec);
+    if ($status == 1 or ($status && $opts->{require_valid_signature})) {
+        error(g_('cannot verify signature for %s'), $data);
+    } elsif ($status) {
+        warning(g_('cannot verify signature for %s'), $data);
+    }
+
+    return;
 }
 
 sub inline_verify {

-- 
Dpkg.Org's dpkg

Reply via email to