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

Bug#801104: marked as done (lintian: dh-exec check improvements)



Your message dated Sun, 20 Dec 2015 01:06:10 +0000
with message-id <E1aASRu-0006SC-O5@franck.debian.org>
and subject line Bug#801104: fixed in lintian 2.5.39
has caused the Debian Bug report #801104,
regarding lintian: dh-exec check improvements
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
801104: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=801104
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Source: lintian
Severity: wishlist
Version: 2.5.38
Tags: patch

Attached are two patches against lintian master, which do the following:

* The first teaches lintian about some new dh-exec features, such as
  architecture and build profile filters. Therefore, the
  "dh-exec-script-without-dh-exec-features" tag will not be emitted for
  packages that make use of these new features, but not the old ones.

* The second one is an attempt at catching unnecessary dh-exec use: when
  one uses dh-exec to install /usr/lib/${DEB_HOST_MULTIARCH}, that can
  be done with a simple wildcard, without dh-exec. There may be false
  positives, so the new tag is of wishlist severity only.

-- 
|8]
>From 6b35ed7bb3ac3efcfe2ba253c0b3c0514f29c165 Mon Sep 17 00:00:00 2001
From: Gergely Nagy <algernon@madhouse-project.org>
Date: Tue, 6 Oct 2015 11:54:07 +0200
Subject: [PATCH 1/2] checks/debhelper.pm: Update the dh-exec feature checks

Update the dh-exec feature checks to notice the arch and build profile
filters too, and not emit dh-exec-script-without-dh-exec-features if
these are used.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
---
 checks/debhelper.pm                             | 6 ++++--
 t/tests/debhelper-dh-exec/debian/debian/dirs    | 2 ++
 t/tests/debhelper-dh-exec/debian/debian/install | 2 +-
 t/tests/debhelper-dh-exec/debian/debian/rules   | 1 +
 t/tests/debhelper-dh-exec/tags                  | 2 +-
 5 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100755 t/tests/debhelper-dh-exec/debian/debian/dirs

diff --git a/checks/debhelper.pm b/checks/debhelper.pm
index f40f8ab..59c1341 100644
--- a/checks/debhelper.pm
+++ b/checks/debhelper.pm
@@ -481,7 +481,7 @@ sub _check_dh_exec {
         tag 'dh-exec-private-helper', $path;
     }
 
-    my ($dhe_subst, $dhe_install) = (0, 0);
+    my ($dhe_subst, $dhe_install, $dhe_filter) = (0, 0, 0);
     my $fd = $path->open;
     while (<$fd>) {
         if (/\$\{([^\}]+)\}/) {
@@ -499,10 +499,12 @@ sub _check_dh_exec {
             }
         }
         $dhe_install = 1 if / => /;
+        $dhe_filter = 1 if /\[[^\]]+\]/;
+        $dhe_filter = 1 if /<[^>]+>/;
     }
     close($fd);
 
-    if (!($dhe_subst || $dhe_install)) {
+    if (!($dhe_subst || $dhe_install || $dhe_filter)) {
         tag 'dh-exec-script-without-dh-exec-features', $path;
     }
 
diff --git a/t/tests/debhelper-dh-exec/debian/debian/dirs b/t/tests/debhelper-dh-exec/debian/debian/dirs
new file mode 100755
index 0000000..bc147d0
--- /dev/null
+++ b/t/tests/debhelper-dh-exec/debian/debian/dirs
@@ -0,0 +1,2 @@
+#! /usr/bin/dh-exec
+usr/lib
diff --git a/t/tests/debhelper-dh-exec/debian/debian/install b/t/tests/debhelper-dh-exec/debian/debian/install
index bc147d0..819be1a 100755
--- a/t/tests/debhelper-dh-exec/debian/debian/install
+++ b/t/tests/debhelper-dh-exec/debian/debian/install
@@ -1,2 +1,2 @@
 #! /usr/bin/dh-exec
-usr/lib
+usr/lib/foo [linux-any] [hurd-any] [kfreebsd-any]
diff --git a/t/tests/debhelper-dh-exec/debian/debian/rules b/t/tests/debhelper-dh-exec/debian/debian/rules
index 4d45dbe..0a817ea 100755
--- a/t/tests/debhelper-dh-exec/debian/debian/rules
+++ b/t/tests/debhelper-dh-exec/debian/debian/rules
@@ -6,5 +6,6 @@
 override_dh_installman:
 
 override_dh_install:
+	touch debian/debhelper-dh-exec/usr/lib/foo
 
 override_dh_link:
diff --git a/t/tests/debhelper-dh-exec/tags b/t/tests/debhelper-dh-exec/tags
index 2d0786a..b418aee 100644
--- a/t/tests/debhelper-dh-exec/tags
+++ b/t/tests/debhelper-dh-exec/tags
@@ -2,4 +2,4 @@ E: debhelper-dh-exec source: dh-exec-install-not-allowed-here debian/links
 E: debhelper-dh-exec source: dh-exec-private-helper debian/manpages
 E: debhelper-dh-exec source: package-uses-dh-exec-but-lacks-build-depends
 I: debhelper-dh-exec source: dh-exec-subst-unknown-variable debian/manpages DEB_BUILD_WHATEVER
-W: debhelper-dh-exec source: dh-exec-script-without-dh-exec-features debian/install
+W: debhelper-dh-exec source: dh-exec-script-without-dh-exec-features debian/dirs
-- 
2.5.3

>From d279b43ea3cec4664b6a23404562c939309c5c17 Mon Sep 17 00:00:00 2001
From: Gergely Nagy <algernon@madhouse-project.org>
Date: Tue, 6 Oct 2015 12:28:21 +0200
Subject: [PATCH 2/2] checks/debhelper.pm: Add a new dh-exec test

The new check tries to find cases where using dh-exec is not needed, and
a better, simpler solution exists. The new tag, dh-exec-useless-usage is
emitted when lintian finds a construct where a wildcard would do instead
of using dh-exec's variable substitution powers.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
---
 checks/debhelper.desc                           | 20 ++++++++++++++++++
 checks/debhelper.pm                             | 28 +++++++++++++++++++++++++
 t/tests/debhelper-dh-exec/debian/debian/install |  3 +++
 t/tests/debhelper-dh-exec/desc                  |  1 +
 t/tests/debhelper-dh-exec/tags                  |  2 ++
 5 files changed, 54 insertions(+)

diff --git a/checks/debhelper.desc b/checks/debhelper.desc
index 11783a4..89f6ab6 100644
--- a/checks/debhelper.desc
+++ b/checks/debhelper.desc
@@ -331,6 +331,26 @@ Info: The package uses a variable in one of its debhelper config
  the build one way or the other, then this tag can be safely ignored
  or overridden.
 
+Tag: dh-exec-useless-usage
+Severity: wishlist
+Certainty: possible
+Info: The package uses dh-exec for things it is not needed for.
+ .
+ This typically includes using ${DEB_HOST_MULTIARCH} in an install
+ target where a wildcard would suffice. For example, if you had:
+ .
+  #! /usr/bin/dh-exec
+  usr/lib/${DEB_HOST_MULTIARCH}
+ .
+ This could be replaced with the following in most cases, dropping the
+ need for dh-exec:
+ .
+  usr/lib/*
+ .
+ However, there may be other directories that match the wildcard,
+ which one does not wish to install. In that case, this warning should
+ be ignored or overridden.
+
 Tag: debhelper-compat-file-is-missing
 Severity: normal
 Certainty: certain
diff --git a/checks/debhelper.pm b/checks/debhelper.pm
index 59c1341..db00b5a 100644
--- a/checks/debhelper.pm
+++ b/checks/debhelper.pm
@@ -501,6 +501,33 @@ sub _check_dh_exec {
         $dhe_install = 1 if / => /;
         $dhe_filter = 1 if /\[[^\]]+\]/;
         $dhe_filter = 1 if /<[^>]+>/;
+
+        if (/^usr\/lib\/\$\{([^\}]+)\}\/?$/ ||
+            /^usr\/lib\/\$\{([^\}]+)\}\/?\s+\/usr\/lib\/\$\{([^\}]+)\}\/?$/) {
+            my $sv = $1;
+            my $dv = $2;
+            my $dhe_useless = 0;
+
+            if (
+                $sv =~ m{ \A
+                   DEB_(?:BUILD|HOST)_(?:
+                       ARCH (?: _OS|_CPU|_BITS|_ENDIAN )?
+                      |GNU_ (?:CPU|SYSTEM|TYPE)|MULTIARCH
+             ) \Z}xsm
+              ) {
+                if (defined($dv)) {
+                    $dhe_useless = ($sv eq $dv);
+                } else {
+                    $dhe_useless = 1;
+                }
+            }
+            if ($dhe_useless) {
+                my $form = $_;
+                chomp ($form);
+                $form = "\"$form\"";
+                tag 'dh-exec-useless-usage', $path, $form;
+            }
+        }
     }
     close($fd);
 
@@ -511,6 +538,7 @@ sub _check_dh_exec {
     if ($dhe_install && ($base ne 'install' && $base ne 'manpages')) {
         tag 'dh-exec-install-not-allowed-here', $path;
     }
+
     return;
 }
 
diff --git a/t/tests/debhelper-dh-exec/debian/debian/install b/t/tests/debhelper-dh-exec/debian/debian/install
index 819be1a..50055cb 100755
--- a/t/tests/debhelper-dh-exec/debian/debian/install
+++ b/t/tests/debhelper-dh-exec/debian/debian/install
@@ -1,2 +1,5 @@
 #! /usr/bin/dh-exec
 usr/lib/foo [linux-any] [hurd-any] [kfreebsd-any]
+usr/lib/${DEB_HOST_MULTIARCH}
+usr/lib/${DEB_HOST_MULTIARCH} /usr/lib/${DEB_HOST_MULTIARCH}/
+usr/lib/${DEB_BUILD_MULTIARCH} /usr/lib/${DEB_HOST_MULTIARCH}/
diff --git a/t/tests/debhelper-dh-exec/desc b/t/tests/debhelper-dh-exec/desc
index 5847cbe..c8dd8a9 100644
--- a/t/tests/debhelper-dh-exec/desc
+++ b/t/tests/debhelper-dh-exec/desc
@@ -10,4 +10,5 @@ Test-For:
  dh-exec-private-helper
  dh-exec-script-without-dh-exec-features
  dh-exec-subst-unknown-variable
+ dh-exec-useless-usage
  package-uses-dh-exec-but-lacks-build-depends
diff --git a/t/tests/debhelper-dh-exec/tags b/t/tests/debhelper-dh-exec/tags
index b418aee..50d5f12 100644
--- a/t/tests/debhelper-dh-exec/tags
+++ b/t/tests/debhelper-dh-exec/tags
@@ -2,4 +2,6 @@ E: debhelper-dh-exec source: dh-exec-install-not-allowed-here debian/links
 E: debhelper-dh-exec source: dh-exec-private-helper debian/manpages
 E: debhelper-dh-exec source: package-uses-dh-exec-but-lacks-build-depends
 I: debhelper-dh-exec source: dh-exec-subst-unknown-variable debian/manpages DEB_BUILD_WHATEVER
+I: debhelper-dh-exec source: dh-exec-useless-usage debian/install "usr/lib/${DEB_HOST_MULTIARCH} /usr/lib/${DEB_HOST_MULTIARCH}/"
+I: debhelper-dh-exec source: dh-exec-useless-usage debian/install "usr/lib/${DEB_HOST_MULTIARCH}"
 W: debhelper-dh-exec source: dh-exec-script-without-dh-exec-features debian/dirs
-- 
2.5.3


--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 2.5.39

We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 801104@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Niels Thykier <niels@thykier.net> (supplier of updated lintian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 20 Dec 2015 00:56:05 +0000
Source: lintian
Binary: lintian
Architecture: source
Version: 2.5.39
Distribution: unstable
Urgency: medium
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Niels Thykier <niels@thykier.net>
Description:
 lintian    - Debian package checker
Closes: 773087 790739 794296 795036 801104 806504 808050 808369
Changes:
 lintian (2.5.39) unstable; urgency=medium
 .
   * Summary of tag changes:
     + Added:
       - dh-exec-useless-usage
       - systemd-service-alias-without-extension
 .
   * checks/binaries.pm:
     + [JW] Fix inconsistent parsing of a data file.
   * checks/cruft.pm:
     + [BR] Relax line length for minified javascript.
   * checks/debhelper.{desc,pm}:
     + [NT] Apply patches from Gergely Nagy to extend the dh-exec
       related checks.  (Closes: #794296, #801104)
   * checks/files.{desc,pm}:
     + [JW] Fix typo.
     + [JW] Fix inconsistent parsing of a data file.  (Closes: #790739)
   * checks/scripts.desc:
     + [JW] Fix typo.
   * checks/systemd.{desc,pm}:
     + [NT] Apply patch from Evgeni Golov to strip ".service" from
       aliases before looking for an init.d service of same name.
       (Closes: #773087)
     + [NT] Apply patch from Evgeni Golov to check that the Alias
       field of .service files ends with .service (as required by
       the systemd.unit specification).  (Closes: #808369)
 .
   * data/binaries/embedded-libs:
     + [JW] Apply patch from James Cowgill to rename "polarssl" as
       "mbedtls".  (Closes: #808050)
   * data/binaries/hardening-tags:
     + [NT] Refresh with dpkg-architecture 1.18.3.
   * data/common/{architectures,multiarch-dirs}:
     + [NT] Refresh with dpkg-architecture 1.18.3.
   * data/fields/binary-fields:
     + [NT] Add "Auto-Built-Package" as known field in binary packages.
       It appears in dbgsym packages generated by debhelper.
   * data/fields/perl-provides:
     + [NT] Refresh against perl 5.22.
   * data/files/triplets:
     + [NT] Refresh with dpkg-architecture 1.18.3.
   * data/scripts/interpreters:
     + [JW] Add rake as a known interpreter.  Thanks to Cédric Boutillier
       and Pirate Praveen for the bug reports.  (Closes: #795036)
   *  data/shared-libs/ldconfig-dirs:
     + [NT] Refresh with dpkg-architecture 1.18.3.
   * data/spelling/corrections*:
     + [JW, AB] Add more corrections.
       Thanks to Paul Wise for patch for one of them.
 .
   * doc/examples/profiles/my-vendor/main.profile:
     + [JW] Fix typo.
 .
   * doc/lintian.xml:
     + [JW] Fix typo.
 .
   * lib/Lintian/Output.pm:
     + [JW] Fix typos.
 .
   * lib/Lintian/Profile.pm:
     + [JW] Fix typo.
 .
   * lib/Lintian/Tags.pm:
     + [JW] Fix typo.
     + [JW] Make it possible to override tags containing "+" characters,
       such as "missing-dependency-on-libstdc++".  Thanks to Andreas
       Beckmann for the bug report.  (Closes: #806504)
 .
   * lib/Test/Lintian.pm:
     + [JW] Fix typo.
 .
   * private/refresh-insserv-data:
     + [JW] Fix typo.
Checksums-Sha1:
 24a2cd1347e728a1dcc4c1a789b16b1802e82b20 2776 lintian_2.5.39.dsc
 b2f14b02b04143a3f0cfa6d0924ec9db9265f1e1 1255020 lintian_2.5.39.tar.xz
Checksums-Sha256:
 4199ee232bd6cd4733803d2a04d968fd56cb919d3266cfa2e44b0f1e77114355 2776 lintian_2.5.39.dsc
 ecc29650975407ee2775022f7769393e8875bb14a0a030b97040506c287069eb 1255020 lintian_2.5.39.tar.xz
Files:
 977c5d1ee3d40d8a08e6e8e1979f401b 2776 devel optional lintian_2.5.39.dsc
 849bcd213284edff2f6b7086179d627f 1255020 devel optional lintian_2.5.39.tar.xz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJWdf0MAAoJEAVLu599gGRC9SIP+gI9Wvvzwq6esHlGS+vM54l+
PsN9GbBr6RM2Sn7A0CMnsVL5ygOt3V1ncskl8PF2I8XECCvbRXF3Pm/crZpjLpn2
hvJdgv0VRasHLTXc49dPqcIQ29/w2D2PxjDJYrWSLEcUp1bwF+bLCxYtWGlWrGes
1W/FuGX9XljhlRcrqtxbO6Os9m9d5JWQYEwI5sXfb48Y6ppKYTS5hXZ9Z/dkLar1
Jqle7CLC/h6PeJ3ASQlH9VkvgtgLewOgqFbP6DsOoY6JZILbIlhw6RE07Sbg6nYa
njKklCNdVAaiFomERmThVj7tKDGWLlYlgEZowbydCf2tLEg2GshIZfFzoUcSgmeg
SOKEaZ4HDEFad0O81qlfIHOt2dvBPCCkr92Ri64cuVITSx2TfWG1TGNjuQHE9qAq
h1BBCnsbg1gB60oN2IKdhA6AVCQKGz7in6J9YCSvhdyB3Yf0kkz2r7mSpQcBx0/h
0vpsz5S/IgDt3FPXYxjyqDi50fup8dUTfsw5g/4vsKvDIxK9yW0IALtl7SYjTM15
GSwYNXuSADZmw4+j4hHWK1v6CGHuYTl5UPHp0yW/ztHyg9Xb1gLBm1wXTRYSHkdt
LunqdsvD7D8J0ocjxRpHPt3F+V6H5cZ5J6R+cJTcY7qIy5ftW8Pl0EaCZz/naqUN
f3Iw+gyt1vyZTGUYD1ua
=oA/1
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: