[SCM] Debian package checker branch, master, updated. 2.5.11-247-gfed3588

2013-04-13 Thread Niels Thykier
The following commit has been merged in the master branch:
commit fed3588cea6f8ae3366ee4a19d25824801cf0e5a
Author: Niels Thykier ni...@thykier.net
Date:   Sat Apr 13 11:01:31 2013 +0200

t: Add missing tag in Test-For field

Signed-off-by: Niels Thykier ni...@thykier.net

diff --git a/t/tests/files-adobe-font/desc b/t/tests/files-adobe-font/desc
index adb0c13..08f339b 100644
--- a/t/tests/files-adobe-font/desc
+++ b/t/tests/files-adobe-font/desc
@@ -2,4 +2,6 @@ Testname: files-adobe-font
 Sequence: 6000
 Version: 1.0
 Description: Test for adobe font license issues
-Test-For: font-adobe-copyrighted-fragment
+Test-For:
+ font-adobe-copyrighted-fragment
+ font-adobe-copyrighted-fragment-no-credit

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/e1uqwlr-ta...@vasks.debian.org



[SCM] Debian package checker branch, master, updated. 2.5.11-247-gfed3588

2013-04-13 Thread Niels Thykier
The following commit has been merged in the master branch:
commit c8b97181e1b78508c9264a559368b9dca6540f77
Author: Niels Thykier ni...@thykier.net
Date:   Sat Apr 13 11:00:23 2013 +0200

c/files: Check for files in non-UTF-8 encoding

Signed-off-by: Niels Thykier ni...@thykier.net

diff --git a/checks/files b/checks/files
index 5ba18c8..c77e07b 100644
--- a/checks/files
+++ b/checks/files
@@ -26,7 +26,7 @@ use File::Basename;
 
 use Lintian::Data;
 use Lintian::Tags qw(tag);
-use Lintian::Util qw(fail open_gz);
+use Lintian::Util qw(fail is_string_utf8_encoded open_gz);
 
 my $FONT_PACKAGES = Lintian::Data-new ('files/fonts', qr/\s++/);
 my $TRIPLETS = Lintian::Data-new ('files/triplets', qr/\s++/);
@@ -242,7 +242,6 @@ if (!$is_dummy) {
 
 # Read package contents...
 foreach my $file ($info-sorted_index) {
-next if $file eq '';
 my $index_info = $info-index ($file);
 my $owner = $index_info-owner . '/' . $index_info-group;
 my $operm = $index_info-operm;
@@ -250,6 +249,10 @@ foreach my $file ($info-sorted_index) {
 
 $arch_dep_files = 1 if $file !~ m,^usr/share/,o  $file ne 'usr/';
 
+if (!is_string_utf8_encoded($file)) {
+tag 'file-name-is-not-valid-UTF-8', $file;
+}
+
 if ($index_info-is_hardlink) {
 my $link_target_dir = $link;
 $link_target_dir =~ s,[^/]*$,,;
diff --git a/checks/files.desc b/checks/files.desc
index 0e47660..12d571a 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -1304,3 +1304,13 @@ Tag: dir-or-file-in-build-tree
 Severity: serious
 Certainty: possible
 Info: Your package install file in our build tree.
+
+Tag: file-name-is-not-valid-UTF-8
+Severity: normal
+Certainty: certain
+Ref: #701081
+Info: The file name does not appear to be valid UTF-8.  This may become
+ a requirement in future Policy versions.
+ .
+ Note that Lintian may be unable to display the filename accurately.
+ Unprintable characters may have been replaced.
diff --git a/debian/changelog b/debian/changelog
index 8205368..c72abfa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ lintian (2.5.12) UNRELEASED; urgency=low
   - dir-or-file-in-build-tree
   - dir-or-file-in-etc-opt
   - dir-or-file-in-home
+  - file-name-is-not-valid-UTF-8
   - font-adobe-copyrighted-fragment-no-credit
   - font-package-not-multi-arch-foreign
   - illegal-runtime-test-name
@@ -94,6 +95,9 @@ lintian (2.5.12) UNRELEASED; urgency=low
   spotting it.  (Closes: #699452)
 + [NT] Add patch from Bastien Roucariès to check for another
   adobe font license issues.  (Closes: #705175)
++ [NT] Test for use of file names that are contain invalid
+  UTF-8 byte sequences.  Thanks to Helmut Grohne for the
+  suggestion.  (Closes: #704446)
   * checks/init.d:
 + [NT] Fix regression where Lintian would not properly match
   init.d passed to update-rc.d.  Thanks to Michael Meskes for
diff --git a/lib/Lintian/Util.pm b/lib/Lintian/Util.pm
index df7c093..9c9fd4f 100644
--- a/lib/Lintian/Util.pm
+++ b/lib/Lintian/Util.pm
@@ -57,6 +57,7 @@ BEGIN {
  get_file_checksum
  slurp_entire_file
  file_is_encoded_in_non_utf8
+ is_string_utf8_encoded
  fail
  strip
  lstrip
@@ -712,6 +713,29 @@ sub get_file_checksum {
 return $digest-hexdigest;
 }
 
+=item is_string_utf8_encoded(STRING)
+
+Returns a truth value if STRING can be decoded as valid UTF-8.
+
+=cut
+
+sub is_string_utf8_encoded {
+my ($str) = @_;
+if ($str =~ m,\e[-!\$%()*+./],) {
+# ISO-2022
+return 0;
+}
+eval {
+Encode::decode('UTF-8', $str, Encode::FB_CROAK);
+};
+if ($@) {
+# fail
+return 0;
+}
+# pass
+return 1;
+}
+
 =item file_is_encoded_in_non_utf8 (...)
 
 Undocumented
@@ -726,15 +750,7 @@ sub file_is_encoded_in_non_utf8 {
 or fail(failure while checking encoding of $file for $type package 
$pkg);
 my $line = 0;
 while ($fd) {
-if (m,\e[-!\$%()*+./],) {
-# ISO-2022
-$line = $.;
-last;
-}
-eval {
-$_ = Encode::decode('UTF-8', $_, Encode::FB_CROAK);
-};
-if ($@) {
+if (!is_string_utf8_encoded($_)) {
 $line = $.;
 last;
 }
diff --git a/t/tests/files-general/debian/debian/rules 
b/t/tests/files-general/debian/debian/rules
index 1806e1d..e5e7c6e 100755
--- a/t/tests/files-general/debian/debian/rules
+++ b/t/tests/files-general/debian/debian/rules
@@ -13,6 +13,10 @@ override_dh_install:
touch $(tmp)/usr/share/foo/'*'
touch $(tmp)/usr/share/foo/'ws '
touch $(tmp)/usr/share/foo/.nfs-fake-tmpfile
+   # If the following line gets messed up, it can be
+   # restored with something like:
+   #   sed -i 's/@FILE@/bokm\xe5l/'
+   touch $(tmp)/usr/share/foo/bokm�l
touch 

Processed: limit source to lintian, tagging 704446

2013-04-13 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 #lintian (2.5.12) UNRELEASED; urgency=low
 #
 #  * checks/files{,.desc}:
 #+ [NT] Apply patch from Bastien Roucariès to catch paths
 #  in (common) build dirs.  (Closes: #678857)
 #+ [NT] Do not suggest the use of virtual package as a way
 #  to suppress empty-binary-package.  Lintian will still
 #  accept it the phrase for now.
 #+ [NT] Accept libx32 as an bi-arch directory.
 #+ [NT] Ignore gzipped lintian overrides when checking whether
 #  a package is empty.
 #+ [NT] Fix typo of Pre-Depends, thanks to Raúl Benencia for
 #  spotting it.  (Closes: #699452)
 #+ [NT] Add patch from Bastien Roucariès to check for another
 #  adobe font license issues.  (Closes: #705175)
 #+ [NT] Test for use of file names that are contain invalid
 #  UTF-8 byte sequences.  Thanks to Helmut Grohne for the
 #  suggestion.  (Closes: #704446)
 #
 limit source lintian
Limiting to bugs with field 'source' containing at least one of 'lintian'
Limit currently set to 'source':'lintian'

 tags 704446 + pending
Bug #704446 [lintian] lintian: warn about filenames containing invalid UTF-8 
sequences in binary packages
Added tag(s) pending.
 thanks
Stopping processing here.

Please contact me if you need assistance.
-- 
704446: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704446
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


--
To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.13658437727548.transcr...@bugs.debian.org



Bug#704197: Please review: systemd checks

2013-04-13 Thread Michael Stapelberg
Hi Niels,

Thanks for your prompt reply.

Niels Thykier ni...@thykier.net writes:
 Tests!  Once there are tests for all the new tags (and none of the
 existing tests breaks) we are usually ready to accept the checks.
Cool.

Find attached two git format-patch files. The first adds the latest
version of my systemd checks, the second one adds tests.

Could you please have a look at the tests? Please note that I did not
run the whole testsuite because it fails on my machine (see my IRC
query). It’d be great if you could run it for me.

-- 
Best regards,
Michael
From eb5c8b33019e1b838f675bd455052b3d1347fe75 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg mich...@stapelberg.de
Date: Sat, 13 Apr 2013 23:14:31 +0200
Subject: [PATCH 1/2] add systemd checks

---
 checks/systemd  |  252 +++
 checks/systemd.desc |   76 
 2 files changed, 328 insertions(+)
 create mode 100644 checks/systemd
 create mode 100644 checks/systemd.desc

diff --git a/checks/systemd b/checks/systemd
new file mode 100644
index 000..866110c
--- /dev/null
+++ b/checks/systemd
@@ -0,0 +1,252 @@
+# systemd -- lintian check script -*- perl -*-
+#
+# Copyright © 2013 Michael Stapelberg
+#
+# based on the apache2 checks file by:
+# Copyright © 2012 Arno Töll
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::systemd;
+
+use strict;
+use warnings;
+
+use File::Basename;
+use Text::ParseWords qw(shellwords);
+
+use Lintian::Tags qw(tag);
+use Lintian::Util qw(fail);
+
+sub run {
+my ($pkg, $type, $info) = @_;
+
+# Figure out whether the maintainer of this package did any effort to
+# make the package work with systemd. If not, we will not warn in case
+# of an init script that has no systemd equivalent, for example.
+my $ships_systemd_file = (scalar ( grep { m,/systemd/, } $info-sorted_index )  0);
+
+# An array of names which are provided by the service files.
+# This includes Alias= directives, so after parsing
+# NetworkManager.service, it will contain NetworkManager and
+# network-manager.
+my @systemd_targets;
+
+for my $file ($info-sorted_index) {
+if ($file =~ m,^etc/tmpfiles\.d/.*\.conf$,) {
+tag 'systemd-tmpfiles.d-outside-usr-lib', $file;
+}
+if ($file =~ m,^etc/systemd/system/.*\.service$,) {
+tag 'systemd-service-file-outside-lib', $file;
+}
+if ($file =~ m,/systemd/system/.*\.service$,) {
+check_systemd_service_file ($pkg, $info, $file);
+for my $name (extract_service_file_names ($pkg, $info, $file)) {
+push @systemd_targets, $name;
+}
+}
+}
+
+my @init_scripts = grep { m,^etc/init\.d/.+, } $info-sorted_index;
+
+# Verify that each init script includes /lib/lsb/init-functions,
+# because that is where the systemd diversion happens.
+for my $init_script (@init_scripts) {
+check_init_script ($pkg, $info, $init_script);
+}
+
+@init_scripts = map { basename($_) } @init_scripts;
+
+if ($ships_systemd_file) {
+for my $init_script (@init_scripts) {
+tag 'systemd-no-service-for-init-script', $init_script
+unless grep /\Q$init_script\E\.service/, @systemd_targets;
+}
+}
+
+check_maintainer_scripts ($info);
+}
+
+sub check_init_script {
+my ($pkg, $info, $file) = @_;
+
+my $lsb_source_seen;
+my $path = $info-index ($file);
+unless ($path-is_regular_file ||
+($path-is_symlink  defined($path-link_resolved))) {
+tag 'init-script-is-not-a-file', $file;
+return;
+}
+open(my $fh, '', $info-unpacked ($file))
+or fail cannot open $file: $!;
+while ($fh) {
+s/^\s+//;
+next if /^#/;
+if (m,^(?:\.|source)\s+/lib/lsb/init-functions,) {
+$lsb_source_seen = 1;
+last;
+}
+}
+close($fh);
+
+if (!$lsb_source_seen) {
+tag 'init.d-script-does-not-source-init-functions', $file;
+}
+}
+
+sub check_systemd_service_file {
+my ($pkg, $info, $file) = @_;
+
+my @values = extract_service_file_values ($pkg, $info, $file, 'Unit',