[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 02/02: Read lintian's .desc files with UTF-8 encoding



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

nthykier pushed a commit to branch master
in repository lintian.

commit deeaccd609fc0d378fc88b77ebd4cdc57f6f99b3
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Aug 14 21:24:06 2015 +0200

    Read lintian's .desc files with UTF-8 encoding
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog           | 6 ++++++
 lib/Lintian/CheckScript.pm | 6 +++---
 lib/Lintian/CollScript.pm  | 4 ++--
 lib/Lintian/Profile.pm     | 4 ++--
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d5559ff..d0bdcf9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,9 +38,15 @@ lintian (2.5.36) UNRELEASED; urgency=medium
   * debian/compat:
     + [BR] Use compat version 9.
 
+  * lib/Lintian/{CheckScript,CollScript,Profile}.pm:
+    + [NT] Read control files as proper UTF-8 character streams rather
+      than byte streams.  (Closes: #793164)
   * lib/Lintian/Collect.pm:
     + [AB] Remove outdated note about automatically computed defaults for
       "$info->field('source')".
+  * lib/Lintian/Util.pm:
+    + [NT] Add read_dpkg_control_utf8 that reads the file as UTF-8
+      characters (as it ought to be) rather than a byte stream.
 
   * private/refresh-fonts-data:
     + [NT] Prune some duplicates from the generated font file.
diff --git a/lib/Lintian/CheckScript.pm b/lib/Lintian/CheckScript.pm
index 4514779..498245d 100644
--- a/lib/Lintian/CheckScript.pm
+++ b/lib/Lintian/CheckScript.pm
@@ -28,7 +28,7 @@ use parent 'Class::Accessor::Fast';
 use Carp qw(croak);
 
 use Lintian::Tag::Info ();
-use Lintian::Util qw(read_dpkg_control unix_locale_split);
+use Lintian::Util qw(read_dpkg_control_utf8 unix_locale_split);
 
 =head1 NAME
 
@@ -73,7 +73,7 @@ given, translations for the check will be loaded as well.
 
 sub new {
     my ($class, $basedir, $checkname, $profile, $lang) = @_;
-    my ($header, @tags) = read_dpkg_control("$basedir/${checkname}.desc");
+    my ($header, @tags) = read_dpkg_control_utf8("$basedir/${checkname}.desc");
     my ($self, %loc, $dir, $name);
     unless ($name = $header->{'check-script'}) {
         croak "Missing Check-Script field in $basedir/${checkname}.desc";
@@ -87,7 +87,7 @@ sub new {
             for my $i10n (@i10ns) {
                 my $path = "${path_prefix}_${i10n}.desc";
                 if (-f $path) {
-                    my ($header, @paras) = read_dpkg_control($path);
+                    my ($header, @paras) = read_dpkg_control_utf8($path);
                     my $for_check = $header->{'check-script-translation'};
                     if (not defined($for_check)
                         or $for_check ne $name) {
diff --git a/lib/Lintian/CollScript.pm b/lib/Lintian/CollScript.pm
index a6b77f2..02122d7 100644
--- a/lib/Lintian/CollScript.pm
+++ b/lib/Lintian/CollScript.pm
@@ -26,7 +26,7 @@ use parent 'Class::Accessor::Fast';
 use Carp qw(croak);
 use File::Basename qw(dirname);
 
-use Lintian::Util qw(fail get_dsc_info);
+use Lintian::Util qw(fail read_dpkg_control_utf8);
 
 =head1 NAME
 
@@ -60,7 +60,7 @@ Parse FILE as a collection desc file.
 
 sub new {
     my ($class, $file) = @_;
-    my $header = get_dsc_info($file);
+    my ($header, undef) = read_dpkg_control_utf8($file);
     my $self;
     foreach my $field (qw(collector-script type version)) {
         if (($header->{$field}//'') eq '') {
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index d41d846..68065b8 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -31,7 +31,7 @@ use Dpkg::Vendor qw(get_current_vendor get_vendor_info);
 
 use Lintian::CheckScript;
 use Lintian::Tags;
-use Lintian::Util qw(parse_boolean read_dpkg_control strip);
+use Lintian::Util qw(parse_boolean read_dpkg_control_utf8 strip);
 
 =head1 NAME
 
@@ -352,7 +352,7 @@ sub _read_profile {
     my $pmap = $self->{'parent-map'};
     my $pname;
     my $plist = $self->{'profile_list'};
-    @pdata = read_dpkg_control($pfile, 0);
+    @pdata = read_dpkg_control_utf8($pfile, 0);
     $pheader = shift @pdata;
     croak "Profile field is missing from $pfile"
       unless defined $pheader && $pheader->{'profile'};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: