[lintian] 01/01: Check for packages that invoke AC_PATH_PROG without considering cross-compilation. Thanks to Helmut Grohne for the idea and proof-of-concept implementation. (Closes: #884798)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 70c81c7f1c9e96c8109988efe8aeca7ed17f122a
Author: Chris Lamb <lamby@debian.org>
Date: Fri Dec 22 20:06:34 2017 +0000
Check for packages that invoke AC_PATH_PROG without considering cross-compilation. Thanks to Helmut Grohne for the idea and proof-of-concept implementation. (Closes: #884798)
---
checks/cruft.desc | 15 +++++++++++++++
checks/cruft.pm | 12 ++++++++++++
debian/changelog | 4 ++++
.../debian/configure.ac | 1 +
.../debian/configure.in | 1 +
.../debian/src/configure.ac | 1 +
.../debian/src/configure.in | 1 +
.../desc | 5 +++++
.../tags | 4 ++++
9 files changed, 44 insertions(+)
diff --git a/checks/cruft.desc b/checks/cruft.desc
index 8f8dcad..580ea27 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -910,3 +910,18 @@ Info: This file appears to contain one or more lines with trailing
(eg. for Makefiles), you can use the following code snippet:
.
$ sed -i -e 's@[ ]*$@@g' debian/rules
+
+Tag: autotools-pkg-config-invocation-missing-arch-prefix
+Severity: normal
+Certainty: possible
+Info: The package appears to use <tt>AC_PATH_PROG</tt> to discover the
+ location of <tt>pkg-config(1)</tt>. This macro fails to select the correct
+ version to support cross-compilation.
+ .
+ Alternatively, the script directly invokes <tt>pkg-config(1)</tt> without
+ considering an architecture prefix (<tt>$ac_tool_prefix</tt>) for cross
+ compilation.
+ .
+ A better way would be to use the <tt>PKG_PROG_PKG_CONFIG</tt> macro from
+ <tt>pkg.m4</tt> and then using the <tt>$PKG_CONFIG</tt> shell variable.
+Ref: #884798
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 7524103..6ee7241 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -678,6 +678,18 @@ sub find_cruft {
tag 'r-data-without-readme-source', $name;
}
+ if ( $name =~ m,configure.(in|ac)$,
+ && $entry->is_file
+ && $entry->is_open_ok) {
+ my $fd = $entry->open;
+ while (my $line = <$fd>) {
+ tag 'autotools-pkg-config-invocation-missing-arch-prefix',
+ $name, "(line $.)"
+ if $line=~ m{AC_PATH_PROG\s*\([^,]+,\s*\[?pkg-config\]?\s*,};
+ }
+ close($fd);
+ }
+
# Lena Söderberg image
if ($basename =~ /\blenn?a\b/i) {
if( $file_info =~ /\bimage\b/i
diff --git a/debian/changelog b/debian/changelog
index c2c05e9..4d056c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ lintian (2.5.66) UNRELEASED; urgency=medium
XXX: generate tag summary
+ * checks/cruft.{pm,desc}:
+ + [CL] Check for packages that invoke AC_PATH_PROG without considering
+ cross-compilation. Thanks to Helmut Grohne for the idea and
+ proof-of-concept implementation. (Closes: #884798)
* checks/fields.{pm,desc}:
+ [CL] Emit a wishlist warning for packages that mix-and-match more
than one version control system in Vcs-* headers. (Closes: #884503)
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.ac b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.ac
new file mode 100644
index 0000000..0250f9b
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.ac
@@ -0,0 +1 @@
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.in b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.in
new file mode 100644
index 0000000..eeb7274
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/configure.in
@@ -0,0 +1 @@
+AC_PATH_PROG(PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.ac b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.ac
new file mode 100644
index 0000000..0250f9b
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.ac
@@ -0,0 +1 @@
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.in b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.in
new file mode 100644
index 0000000..eeb7274
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/debian/src/configure.in
@@ -0,0 +1 @@
+AC_PATH_PROG(PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/desc b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/desc
new file mode 100644
index 0000000..87cff1c
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/desc
@@ -0,0 +1,5 @@
+Testname: cruft-autotools-pkg-config-invocation-missing-arch-prefix
+Version: 1.0
+Description: Check for packages that look for pkg-config incorrectly
+Test-For:
+ autotools-pkg-config-invocation-missing-arch-prefix
diff --git a/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/tags b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/tags
new file mode 100644
index 0000000..0c26407
--- /dev/null
+++ b/t/tests/cruft-autotools-pkg-config-invocation-missing-arch-prefix/tags
@@ -0,0 +1,4 @@
+W: cruft-autotools-pkg-config-invocation-missing-arch-prefix source: autotools-pkg-config-invocation-missing-arch-prefix configure.ac (line 1)
+W: cruft-autotools-pkg-config-invocation-missing-arch-prefix source: autotools-pkg-config-invocation-missing-arch-prefix configure.in (line 1)
+W: cruft-autotools-pkg-config-invocation-missing-arch-prefix source: autotools-pkg-config-invocation-missing-arch-prefix src/configure.ac (line 1)
+W: cruft-autotools-pkg-config-invocation-missing-arch-prefix source: autotools-pkg-config-invocation-missing-arch-prefix src/configure.in (line 1)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: