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=104ba5982a46472264a117e97e5a3d4c2e7f93c6

commit 104ba5982a46472264a117e97e5a3d4c2e7f93c6
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Nov 10 04:48:37 2022 +0100

    Dpkg::OpenPGP: Make armor idempotent
    
    When we pass this method an already ASCII Armored input, it should
    generate the exact same output.
---
 scripts/Dpkg/OpenPGP.pm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/Dpkg/OpenPGP.pm b/scripts/Dpkg/OpenPGP.pm
index 8a956eced..ff62c008b 100644
--- a/scripts/Dpkg/OpenPGP.pm
+++ b/scripts/Dpkg/OpenPGP.pm
@@ -143,23 +143,24 @@ sub _pgp_armor_data {
 }
 
 sub armor {
-    my ($self, $type, $bin, $asc) = @_;
+    my ($self, $type, $in, $out) = @_;
 
-    my $data = file_slurp($bin);
+    my $raw_data = file_slurp($in);
+    my $data = _pgp_dearmor_data($type, $raw_data) // $raw_data;
     my $armor = _pgp_armor_data($type, $data);
     return OPENPGP_BAD_DATA unless defined $armor;
-    file_dump($asc, $armor);
+    file_dump($out, $armor);
 
     return OPENPGP_OK;
 }
 
 sub dearmor {
-    my ($self, $type, $asc, $bin) = @_;
+    my ($self, $type, $in, $out) = @_;
 
-    my $armor = file_slurp($asc);
+    my $armor = file_slurp($in);
     my $data = _pgp_dearmor_data($type, $armor);
     return OPENPGP_BAD_DATA unless defined $data;
-    file_dump($bin, $data);
+    file_dump($out, $data);
 
     return OPENPGP_OK;
 }

-- 
Dpkg.Org's dpkg

Reply via email to