summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-07 12:12:25 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-07 12:12:25 +0000
commitda614e5c351ebb07e82a55c77b4c713f28f6b6f1 (patch)
tree42360d3b67dcb6bbbffb05135faa8ede8d6c8273 /urpm
parent72e9a5dc416870a48850ff10c071200a13360ca7 (diff)
downloadurpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar
urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.gz
urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.bz2
urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.tar.xz
urpmi-da614e5c351ebb07e82a55c77b4c713f28f6b6f1.zip
- urpmi:
o fix displaying "bad signature" in non-utf8 (#44587)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/msg.pm17
-rw-r--r--urpm/signature.pm5
2 files changed, 19 insertions, 3 deletions
diff --git a/urpm/msg.pm b/urpm/msg.pm
index d5e618b3..c61a9187 100644
--- a/urpm/msg.pm
+++ b/urpm/msg.pm
@@ -7,9 +7,10 @@ no warnings;
use Exporter;
use URPM;
+my $encoding;
BEGIN {
- eval { require encoding };
- eval "use open ':locale'" if eval { encoding::_get_locale_encoding() ne 'ANSI_X3.4-1968' };
+ eval { require encoding; $encoding = encoding::_get_locale_encoding() };
+ eval "use open ':locale'" if $encoding && $encoding ne 'ANSI_X3.4-1968';
}
(our $VERSION) = q($Revision$) =~ /(\d+)/;
@@ -29,6 +30,18 @@ URPM::bind_rpm_textdomain_codeset();
our $no_translation;
+sub from_locale_encoding {
+ my ($s) = @_;
+ $encoding && eval {
+ require Encode;
+ Encode::decode($encoding, $s);
+ } || do {
+ require utf8;
+ utf8::decode($s);
+ $s;
+ } || $s;
+}
+
sub translate {
my ($s, $o_plural, $o_nb) = @_;
my $res;
diff --git a/urpm/signature.pm b/urpm/signature.pm
index ccafa299..e18166a6 100644
--- a/urpm/signature.pm
+++ b/urpm/signature.pm
@@ -22,7 +22,10 @@ sub _check {
$filepath !~ /\.spec$/ or next;
$urpm->{debug} and $urpm->{debug}("verifying signature of $filepath");
- my $verif = URPM::verify_signature($filepath);
+ #- rpmlib is doing strftime %c, and so the string comes from the current encoding
+ #- (URPM::bind_rpm_textdomain_codeset() doesn't help here)
+ #- so we have to transform...
+ my $verif = urpm::msg::from_locale_encoding(URPM::verify_signature($filepath));
if ($verif =~ /NOT OK/) {
$verif =~ s/\n//g;