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

[SCM] Debian package checker branch, master, updated. 2.2.13-11-gf6012f3



The following commit has been merged in the master branch:
commit f6012f3c3a7595c9035815ee2857915068feb710
Author: Russ Allbery <rra@debian.org>
Date:   Fri Jul 24 21:44:17 2009 -0700

    Decode UTF-8 in descriptions before checking line length
    
    * checks/description:
      + [RA] Decode descriptions from UTF-8 before checking length.  Thanks,
        Charles Plessy.  (Closes: #537207)

diff --git a/checks/description b/checks/description
index bc9686d..22d27f1 100644
--- a/checks/description
+++ b/checks/description
@@ -20,6 +20,9 @@
 
 package Lintian::description;
 use strict;
+
+use Encode qw(decode);
+
 use Spelling;
 use Tags;
 use Util;
@@ -63,14 +66,18 @@ if ($synopsis =~ m/^\s*$/) {
     if ($synopsis =~ m/\t/) {
 	tag "description-contains-tabs", "" unless $tabs++;
     }
-    if (length($synopsis) >= 80) {
-	tag "description-too-long", "";
-    }
     if ($synopsis =~ m/^missing\s*$/i) {
 	tag "description-is-debmake-template", "" unless $template++;
     } elsif ($synopsis =~ m/<insert up to 60 chars description>/) {
 	tag "description-is-dh_make-template", "" unless $template++;
     }
+
+    # We have to decode into UTF-8 to get the right length for the length
+    # check.  If the changelog uses a non-UTF-8 encoding, this will mangle it,
+    # but it doesn't matter for the length check.
+    if (length(decode('utf-8', $synopsis)) >= 80) {
+	tag 'description-too-long';
+    }
 }
 
 my $flagged_homepage;
@@ -144,7 +151,7 @@ foreach (split /\n/, $description) {
 	}
     }
 
-    if (length($_) > 80) {
+    if (length(decode('utf-8', $_)) > 80) {
 	tag "extended-description-line-too-long", "";
     }
 }
diff --git a/debian/changelog b/debian/changelog
index 0efe818..4a1d994 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ lintian (2.2.14) unstable; urgency=low
     + Added:
       - patch-system-but-no-source-readme
 
+  * checks/description:
+    + [RA] Decode descriptions from UTF-8 before checking length.  Thanks,
+      Charles Plessy.  (Closes: #537207)
   * checks/fields{,.desc}
     + [FL] packages named lib*-camlp4-dev should be in section ocaml
     + [RA] Move debian/rules parsing to check build dependencies to
diff --git a/t/tests/description-general/debian/debian/control.in b/t/tests/description-general/debian/debian/control.in
index 3720de1..309c147 100644
--- a/t/tests/description-general/debian/debian/control.in
+++ b/t/tests/description-general/debian/debian/control.in
@@ -75,3 +75,13 @@ Package: {$srcpkg}-empty
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
 Description: test package with empty extended description
+
+Package: {$srcpkg}-utf8-long
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: test package with UTF-8 description (“héh锓héh锓héh锓héhé”)
+ Not really too long: “héh锓héh锓héh锓héh锓héh锓héhé”
+ .
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.

-- 
Debian package checker


Reply to: