[lintian] 01/01: Detect old style config script
This is an automated email from the git hooks/post-receive script.
broucaries-guest pushed a commit to branch master
in repository lintian.
commit 90ce8322ca7ead0b1ae4286d4595403a4b8223dd
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date: Sun Jan 3 11:53:07 2016 +0100
Detect old style config script
WHitelist triplet-config when the config file include the same triplet on it.
Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
checks/files.desc | 16 +++-
checks/files.pm | 86 ++++++++++++----------
debian/changelog | 1 +
t/tests/files-old-config-script/debian/Makefile | 2 +-
.../debian/generated/ARCH_-arch-all-config.in | 3 +
.../generated/ARCH_-arch-cross-all-config.in | 3 +
.../generated/ARCH_-arch-cross-foreign-config.in | 3 +
.../debian/generated/ARCH_-arch-foreign-config.in | 2 +
t/tests/files-old-config-script/desc | 1 +
t/tests/files-old-config-script/post_test | 1 +
t/tests/files-old-config-script/tags | 16 ++++
11 files changed, 95 insertions(+), 39 deletions(-)
diff --git a/checks/files.desc b/checks/files.desc
index 48b6917..6c78a13 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -696,7 +696,21 @@ Info: The following file is a old style config file, used
It is typically used to compile and link against one or more libraries.
.
This old style config file contains a multi-arch path and the package
- is not Multi-arch: no or package is arch: all.
+ is not Multi-arch: no.
+ .
+ You should change this package to Multi-arch: no.
+
+Tag: old-style-config-script-multiarch-path-arch-all
+Severity: serious
+Certainty: possible
+Info: The following file is a old style config file, used
+ used to retrieve information about installed libraries in the system.
+ It is typically used to compile and link against one or more libraries.
+ .
+ This old style config file contains a multi-arch path and the package
+ is is arch: all.
+ .
+ You should change the package to arch: any.
Tag: package-contains-upstream-install-documentation
Severity: normal
diff --git a/checks/files.pm b/checks/files.pm
index aad3474..b28e1ad 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -828,45 +828,57 @@ sub run {
tag 'subdir-in-usr-bin', $file;
}
# check old style config script
- elsif ($file->is_regular_file
- && $fname =~ m,-config$,) {
- if ($script{$file}) {
- # try to find some indication of
- # config file (read only one block)
- my $fd = $file->open(':raw');
- my $sfd = Lintian::SlidingWindow->new($fd);
- my $block = $sfd->readwindow();
- if ($block) {
- # some common stuff found in config file
- if ( index($block,'flag')>-1
- or index($block,'/include/') > -1
- or index($block,'pkg-config') > -1) {
- # ok old config style script tag it
- tag 'old-style-config-script',$file;
- my $multiarch = $info->field('multi-arch','');
- # could be ok but only if multi-arch: no
- if($multiarch ne 'no' or $arch eq 'all') {
- # check multi-arch path
- foreach my $arch ($MULTIARCH_DIRS->all) {
- my $madir
- = $MULTIARCH_DIRS->value($arch);
- if ($block =~ m{\W\Q$madir\E(\W|$)}xms)
- {
- #<<< No perltidy - tag name too long
- tag
- 'old-style-config-script-multiarch-path',
- $file,
- 'full text contains architecture specific dir',
- $madir;
- #>>>
- last;
- }
+ elsif ( $file->is_regular_file
+ and $fname =~ m,-config$,
+ and $script{$file}) {
+ # try to find some indication of
+ # config file (read only one block)
+ my $fd = $file->open(':raw');
+ my $sfd = Lintian::SlidingWindow->new($fd);
+ my $block = $sfd->readwindow();
+ # some common stuff found in config file
+ if (
+ $block
+ and ( index($block,'flag')>-1
+ or index($block,'/include/') > -1
+ or index($block,'pkg-config') > -1)
+ ) {
+ # ok old config style script tag it
+ tag 'old-style-config-script',$file;
+ my $multiarch = $info->field('multi-arch','');
+ # could be ok but only if multi-arch: no
+ if($multiarch ne 'no' or $arch eq 'all') {
+ # check multi-arch path
+ foreach my $archs ($MULTIARCH_DIRS->all) {
+ my $madir= $MULTIARCH_DIRS->value($archs);
+ if ($block =~ m{\W\Q$madir\E(\W|$)}xms){
+ # allow files to begin by triplet if it match arch
+ if($file->basename =~ m{^\Q$madir\E}xms) {
+ next;
}
+ if($arch eq 'all') {
+ #<<< No perltidy - tag name too long
+ tag
+ 'old-style-config-script-multiarch-path-arch-all',
+ $file,
+ 'full text contains architecture specific dir',
+ $madir;
+ #>>>
+ } else {
+ #<<< No perltidy - tag name too long
+ tag
+ 'old-style-config-script-multiarch-path',
+ $file,
+ 'full text contains architecture specific dir',
+ $madir;
+ #>>>
+ }
+ last;
}
}
}
- close($fd);
}
+ close($fd);
}
}
# ---------------- /usr subdirs
@@ -1536,12 +1548,12 @@ sub run {
close($fd);
if ($mtime != 0) {
if ($isma_same && $file !~ m/\Q$arch\E/o) {
- tag 'gzip-file-is-not-multi-arch-same-safe', $file;
+ tag 'gzip-file-is-not-multi-arch-same-safe',$file;
} else {
# see https://bugs.debian.org/762105
- my $diff = $file->timestamp - $changelog_timestamp;
+ my $diff= $file->timestamp - $changelog_timestamp;
if ($diff >= 0) {
- tag 'package-contains-timestamped-gzip', $file;
+ tag 'package-contains-timestamped-gzip',$file;
}
}
}
diff --git a/debian/changelog b/debian/changelog
index 58c4643..dd5f172 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,7 @@ lintian (2.5.40) UNRELEASED; urgency=medium
+ [JW] Exclude /usr/lib/debug/.build-id/ from foreign-architecture
checks. Thanks to Aurelien Jarno for the bug report. (Closes:
#809262)
+ + [BR] Detect old style config script and detect Mutli-arch error.
* checks/source-copyright.desc:
+ [JW] Apply patch from Mattia Rizzolo to update the machine-readable
copyright format specification URL. (Closes: #809248)
diff --git a/t/tests/files-old-config-script/debian/Makefile b/t/tests/files-old-config-script/debian/Makefile
index 5026efd..5c7831d 100644
--- a/t/tests/files-old-config-script/debian/Makefile
+++ b/t/tests/files-old-config-script/debian/Makefile
@@ -6,7 +6,7 @@ else
endif
all:
- find generated -name '*-config.in' -exec sh -c 'echo "build" {} && cat {} | sed s/\$$\(ARCH\)/$(ARCH)/g | sed s/\$$\(ARCH_CROSS\)/$(ARCH_CROSS)/g > `echo {} | sed s/\-config\.in$$/\-config/g`' \;
+ find generated -name '*-config.in' -exec sh -c 'echo "build" {} && cat {} | sed -e s/\$$\(ARCH\)/$(ARCH)/g -e s/\$$\(ARCH_CROSS\)/$(ARCH_CROSS)/g > `echo {} | sed -e s/\-config\.in$$/\-config/g -e s,/ARCH_,/$(ARCH)_,g`' \;
install:
install -d $(DESTDIR)/usr/bin
diff --git a/t/tests/files-old-config-script/debian/generated/ARCH_-arch-all-config.in b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-all-config.in
new file mode 100644
index 0000000..8e7070b
--- /dev/null
+++ b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-all-config.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "-I/usr/include/$(ARCH)/someconfig.h"
+
diff --git a/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-all-config.in b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-all-config.in
new file mode 100644
index 0000000..665922b
--- /dev/null
+++ b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-all-config.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "-I/usr/include/$(ARCH_CROSS)/someconfig.h"
+
diff --git a/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-foreign-config.in b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-foreign-config.in
new file mode 100644
index 0000000..665922b
--- /dev/null
+++ b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-cross-foreign-config.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "-I/usr/include/$(ARCH_CROSS)/someconfig.h"
+
diff --git a/t/tests/files-old-config-script/debian/generated/ARCH_-arch-foreign-config.in b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-foreign-config.in
new file mode 100644
index 0000000..9d7a85c
--- /dev/null
+++ b/t/tests/files-old-config-script/debian/generated/ARCH_-arch-foreign-config.in
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo "-I/usr/include/$(ARCH)/arch-include-arch"
diff --git a/t/tests/files-old-config-script/desc b/t/tests/files-old-config-script/desc
index a5b7052..2ca4009 100644
--- a/t/tests/files-old-config-script/desc
+++ b/t/tests/files-old-config-script/desc
@@ -6,3 +6,4 @@ Options: --pedantic -I -E
Test-For:
old-style-config-script
old-style-config-script-multiarch-path
+ old-style-config-script-multiarch-path-arch-all
diff --git a/t/tests/files-old-config-script/post_test b/t/tests/files-old-config-script/post_test
index 006ffa0..7101309 100644
--- a/t/tests/files-old-config-script/post_test
+++ b/t/tests/files-old-config-script/post_test
@@ -1,2 +1,3 @@
s/full text contains architecture specific dir \S+$/full text contains architecture specific dir ARCH/
s, usr/lib/[^/]+/, usr/lib/ARCH/,
+s, usr/bin/[^/]+_-,usr/bin/TRIPLET_-,
diff --git a/t/tests/files-old-config-script/tags b/t/tests/files-old-config-script/tags
index 67fbe68..d84213f 100644
--- a/t/tests/files-old-config-script/tags
+++ b/t/tests/files-old-config-script/tags
@@ -1,10 +1,26 @@
+E: config-all: old-style-config-script-multiarch-path-arch-all usr/bin/arch-all-config full text contains architecture specific dir ARCH
+E: config-all: old-style-config-script-multiarch-path-arch-all usr/bin/arch-cross-all-config full text contains architecture specific dir ARCH
+E: config-all: old-style-config-script-multiarch-path-arch-allusr/bin/TRIPLET_-arch-cross-all-config full text contains architecture specific dir ARCH
E: config-ma-foreign: old-style-config-script-multiarch-path usr/bin/arch-cross-foreign-config full text contains architecture specific dir ARCH
E: config-ma-foreign: old-style-config-script-multiarch-path usr/bin/arch-foreign-config full text contains architecture specific dir ARCH
+E: config-ma-foreign: old-style-config-script-multiarch-pathusr/bin/TRIPLET_-arch-cross-foreign-config full text contains architecture specific dir ARCH
+P: config-all: old-style-config-script usr/bin/arch-all-config
+P: config-all: old-style-config-script usr/bin/arch-cross-all-config
+P: config-all: old-style-config-scriptusr/bin/TRIPLET_-arch-all-config
+P: config-all: old-style-config-scriptusr/bin/TRIPLET_-arch-cross-all-config
P: config-ma-foreign: old-style-config-script usr/bin/arch-cross-foreign-config
P: config-ma-foreign: old-style-config-script usr/bin/arch-foreign-config
+P: config-ma-foreign: old-style-config-scriptusr/bin/TRIPLET_-arch-cross-foreign-config
+P: config-ma-foreign: old-style-config-scriptusr/bin/TRIPLET_-arch-foreign-config
P: config-ma-no: old-style-config-script usr/bin/arch-cross-no-config
P: config-ma-no: old-style-config-script usr/bin/arch-no-config
+W: config-all: binary-without-manpage usr/bin/arch-all-config
+W: config-all: binary-without-manpage usr/bin/arch-cross-all-config
+W: config-all: binary-without-manpageusr/bin/TRIPLET_-arch-all-config
+W: config-all: binary-without-manpageusr/bin/TRIPLET_-arch-cross-all-config
W: config-ma-foreign: binary-without-manpage usr/bin/arch-cross-foreign-config
W: config-ma-foreign: binary-without-manpage usr/bin/arch-foreign-config
+W: config-ma-foreign: binary-without-manpageusr/bin/TRIPLET_-arch-cross-foreign-config
+W: config-ma-foreign: binary-without-manpageusr/bin/TRIPLET_-arch-foreign-config
W: config-ma-no: binary-without-manpage usr/bin/arch-cross-no-config
W: config-ma-no: binary-without-manpage usr/bin/arch-no-config
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: