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

[lintian] 01/01: Add an experimental check for development packages that ship ELF binaries in $PATH. Host architecture binaries are generally not executable so such files are useless for cross builds. (Closes: #794295)



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

lamby pushed a commit to branch master
in repository lintian.

commit fc226826c81a5642779e422d927aa334e2ff1587
Author: Chris Lamb <lamby@debian.org>
Date:   Sat Dec 9 22:43:13 2017 +0000

    Add an experimental check for development packages that ship ELF binaries in $PATH. Host architecture binaries are generally not executable so such files are useless for cross builds. (Closes: #794295)
---
 checks/binaries.desc                                  | 19 +++++++++++++++++++
 checks/binaries.pm                                    |  7 +++++++
 debian/changelog                                      |  6 ++++++
 .../debian/debian/control.in                          | 16 ++++++++++++++++
 .../debian/debian/rules                               | 16 ++++++++++++++++
 .../desc                                              |  7 +++++++
 .../tags                                              |  4 ++++
 7 files changed, 75 insertions(+)

diff --git a/checks/binaries.desc b/checks/binaries.desc
index b23eeb7..8dbca37 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -468,3 +468,22 @@ Info: The listed ELF binary appears to be (partially) built without
  the SOVERSION bump, at the cost of more complex maintenance.
 Ref: http://www.unix.org/version2/whatsnew/lfs20mar.html,
  https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
+
+Tag: development-package-ships-elf-binary-in-path
+Severity: minor
+Certainty: possible
+Experimental: yes
+Info: This package installs the specified ELF binary in <tt>$PATH</tt> and is
+ development package in the <tt>libdevel</tt> section of the archive.
+ .
+ When performing a cross build, host architecture binaries are generally not
+ executable. However development packages need to be installed for the host
+ architecture; such executables are thus useless for cross builds.
+ .
+ (Commonly, executables in development packages provide values that are
+ relevant for using the library. Source packages that use such
+ development packages tend to execute those executables to discover how
+ to use the library.)
+ .
+ An alternative approach is to use pkg-config(1).
+Ref: #794295, #794103
diff --git a/checks/binaries.pm b/checks/binaries.pm
index 20b340d..c3e30bf 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -49,6 +49,9 @@ my $ARCH_REGEX = Lintian::Data->new('binaries/arch-regex', qr/\s*\~\~/o,
 my $ARCH_64BIT_EQUIVS
   = Lintian::Data->new('binaries/arch-64bit-equivs', qr/\s*\=\>\s*/);
 
+my %PATH_DIRECTORIES = map { $_ => 1 } qw(
+  bin/ sbin/ usr/bin/ usr/sbin/ usr/games/ );
+
 sub _embedded_libs {
     my ($key, $val, undef) = @_;
     my $result = {'libname' => $key,};
@@ -342,6 +345,10 @@ sub run {
         # ELF?
         next unless $fileinfo =~ m/^[^,]*\bELF\b/o;
 
+        tag 'development-package-ships-elf-binary-in-path', $file
+          if exists($PATH_DIRECTORIES{$file->dirname})
+          and $info->field('section', 'NONE') eq 'libdevel';
+
         $objdump = $info->objdump_info->{$fname};
 
         if ($arch eq 'all' or not $ARCH_REGEX->known($arch)) {
diff --git a/debian/changelog b/debian/changelog
index a437fbf..be8626b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,12 @@ lintian (2.5.63) UNRELEASED; urgency=medium
 
   XXX: generate tag summary
 
+  * checks/binaries.{pm,desc}:
+    + [CL] Add an experimental check for development packages that ship
+      ELF binaries in $PATH. Host architecture binaries are generally not
+      executable so such files are useless for cross builds.
+      (Closes: #794295)
+
  -- Chris Lamb <lamby@debian.org>  Thu, 07 Dec 2017 16:51:09 +0000
 
 lintian (2.5.62) unstable; urgency=medium
diff --git a/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/control.in b/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/control.in
new file mode 100644
index 0000000..e0cbc76
--- /dev/null
+++ b/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: optional
+Section: libs
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: {$build_depends}
+Rules-Requires-Root: no
+
+Package: libfoo-dev
+Architecture: any
+Section: libdevel
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ 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.
diff --git a/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/rules b/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/rules
new file mode 100755
index 0000000..83d7b16
--- /dev/null
+++ b/t/tests/binaries-development-package-ships-elf-binary-in-path/debian/debian/rules
@@ -0,0 +1,16 @@
+#!/usr/bin/make -f
+
+DESTDIR := debian/$(shell dh_listpackages)
+
+%:
+	dh $@
+
+override_dh_install:
+	mkdir -p $(DESTDIR)/usr/bin
+	cp -a /bin/true $(DESTDIR)/usr/bin/elf-binary
+	
+	mkdir -p $(DESTDIR)/var/lib/private
+	cp -a /bin/true $(DESTDIR)/var/lib/private/elf-binary
+	
+	dh_shlibdeps
+	dh_install
diff --git a/t/tests/binaries-development-package-ships-elf-binary-in-path/desc b/t/tests/binaries-development-package-ships-elf-binary-in-path/desc
new file mode 100644
index 0000000..b2fa826
--- /dev/null
+++ b/t/tests/binaries-development-package-ships-elf-binary-in-path/desc
@@ -0,0 +1,7 @@
+Testname: binaries-development-package-ships-elf-binary-in-path
+Version: 1.0
+Description: Test for development packages shipping ELF binaries in $PATH
+Skeleton: pedantic
+Options: --pedantic -I -E
+Test-For:
+ development-package-ships-elf-binary-in-path 
diff --git a/t/tests/binaries-development-package-ships-elf-binary-in-path/tags b/t/tests/binaries-development-package-ships-elf-binary-in-path/tags
new file mode 100644
index 0000000..1dd4a24
--- /dev/null
+++ b/t/tests/binaries-development-package-ships-elf-binary-in-path/tags
@@ -0,0 +1,4 @@
+I: libfoo-dev: hardening-no-bindnow usr/bin/elf-binary
+I: libfoo-dev: hardening-no-bindnow var/lib/private/elf-binary
+W: libfoo-dev: binary-without-manpage usr/bin/elf-binary
+X: libfoo-dev: development-package-ships-elf-binary-in-path usr/bin/elf-binary

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


Reply to: