Skip to content

Commit 5edee3a

Browse files
committed
Workaround for RT#126994
This commit should be reverted when no longer needed. Also change RIPEMD-160 to (at least) SHA-256 when that happens. - Set gpg digest preference to SHA1 - Only sign with gpg <= v2.1.15
1 parent 49c529b commit 5edee3a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Module/Signature.pm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ use constant SIGNATURE_MISMATCH => -4;
1717
use constant MANIFEST_MISMATCH => -5;
1818
use constant CIPHER_UNKNOWN => -6;
1919

20+
# Enable workaround for RT#126994
21+
use constant RT126994 => 1;
22+
2023
use ExtUtils::Manifest ();
2124
use Exporter;
2225
use File::Spec;
@@ -248,7 +251,12 @@ sub _which_gpg {
248251

249252
for my $gpg_bin ('gpg', 'gnupg', 'gpg2', 'gnupg2', 'gpg1', 'gnupg1') {
250253
my $version = `$gpg_bin --version 2>&1`;
251-
if( $version && $version =~ /GnuPG/ ) {
254+
if( $version && $version =~ /GnuPG.*?(\S+)\s*$/m ) {
255+
# This is a workaround for RT#126994 meant to be reverted when no longer
256+
# needed. Run git blame on this line to find out which commit that is.
257+
if (RT126994) {
258+
_vercmp($1, "2.1.15") <= 0 or next;
259+
}
252260
$which_gpg = $gpg_bin;
253261
return $which_gpg;
254262
}
@@ -449,7 +457,7 @@ sub _sign_gpg {
449457
local *D;
450458
my $set_key = '';
451459
$set_key = qq{--default-key "$AUTHOR"} if($AUTHOR);
452-
open D, "| $gpg $set_key --clearsign --openpgp --personal-digest-preferences RIPEMD160 >> $sigfile.tmp"
460+
open D, "| $gpg $set_key --clearsign --openpgp --personal-digest-preferences SHA1 >> $sigfile.tmp"
453461
or die "Could not call $gpg: $!";
454462
print D $plaintext;
455463
close D;

0 commit comments

Comments
 (0)