[lintian] 04/12: c/shared-libs: Merge and remove some ldconfig tags
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit b0faac690ef577adfa5d68d7c3b73b73f3a8a6b2
Author: Niels Thykier <niels@thykier.net>
Date: Fri Apr 22 17:01:11 2016 +0000
c/shared-libs: Merge and remove some ldconfig tags
Signed-off-by: Niels Thykier <niels@thykier.net>
---
checks/shared-libs.desc | 57 ++++++----------------
checks/shared-libs.pm | 43 +++++++---------
debian/changelog | 3 ++
t/tests/legacy-maintainer-scripts/tags | 2 +-
t/tests/shared-libs-ldconfig-scripts/desc | 6 +--
t/tests/shared-libs-ldconfig-scripts/tags | 10 ++--
.../shared-libs-unversioned/debian/debian/postinst | 13 -----
.../shared-libs-unversioned/debian/debian/postrm | 13 -----
.../shared-libs-unversioned/debian/debian/triggers | 1 +
9 files changed, 43 insertions(+), 105 deletions(-)
diff --git a/checks/shared-libs.desc b/checks/shared-libs.desc
index 2f65127..4399c48 100644
--- a/checks/shared-libs.desc
+++ b/checks/shared-libs.desc
@@ -106,26 +106,22 @@ Info: Although this package is not a "-dev" package, it installs a
override this warning.
Ref: policy 8.4
-Tag: preinst-calls-ldconfig
+Tag: maintscript-calls-ldconfig
Severity: normal
Certainty: certain
-Info: The preinst script calls ldconfig. Calls to ldconfig should only be
- in postinst and postrm scripts (or via a noawait trigger).
-Ref: policy 8.1.1
-
-Tag: prerm-calls-ldconfig
-Severity: normal
-Certainty: certain
-Info: The prerm script calls ldconfig. Calls to ldconfig should only
- be in postinst and postrm scripts (or via a noawait trigger).
-Ref: policy 8.1.1
-
-Tag: postrm-unsafe-ldconfig
-Severity: normal
-Certainty: certain
-Info: The postrm script calls ldconfig unsafely. The postrm
- must only call ldconfig when given the argument "remove".
-Ref: policy 8.1.1
+Info: The given maintainer script calls ldconfig. However, explicit
+ calls in maintainer scripts should be replaced by a dpkg trigger.
+ .
+ Please replace the "ldconfig" call with a <tt>activate-noawait
+ ldconfig</tt> trigger. With debhelper it is usually sufficient
+ to simply add that line to <tt>debian/<package>.triggers</tt>.
+ .
+ If you use debhelper, this warning will appear if the package was
+ compiled with debhelper before 9.20151004. Assuming all ldconfig
+ invocations have been added by debhelper, this warning will
+ disappear once the package is rebuilt with a newer version of
+ debhelper.
+Ref: https://lists.debian.org/debian-devel/2015/08/msg00412.html
Tag: no-shlibs-control-file
Severity: serious
@@ -222,19 +218,6 @@ Info: The udeb invokes ldconfig on install, which is an error in udebs.
Note that this tag may (despite what the name suggests) be issued if
the udeb uses a dpkg trigger to invoke ldconfig.
-Tag: postrm-has-useless-call-to-ldconfig
-Severity: minor
-Certainty: certain
-Info: The postrm script calls ldconfig even though no shared libraries are
- installed in a directory controlled by the dynamic library loader.
- .
- Note this may be triggered by a bug in debhelper, that causes it to
- auto-generate an ldconfig snippet for packages that does not need it.
- .
- This tag may (despite what the name suggests) be issued if the package
- uses a dpkg trigger.
-Ref: policy 8.1.1, #204975
-
Tag: package-must-activate-ldconfig-trigger
Severity: serious
Certainty: certain
@@ -247,18 +230,6 @@ Info: The package installs shared libraries in a directory controlled by
to <tt>debian/<package>.triggers</tt>.
Ref: policy 8.1.1, https://lists.debian.org/debian-devel/2015/08/msg00412.html
-Tag: postrm-should-call-ldconfig
-Severity: important
-Certainty: certain
-Info: The package installs shared libraries in a directory controlled by
- the dynamic library loader. Therefore, the package must call "ldconfig" in
- during removal.
- .
- This should either be done via a <tt>activate-noawait ldconfig</tt>
- trigger or by calling "ldconfig" directly in the postrm script on
- the "remove" step.
-Ref: policy 8.1.1
-
Tag: sharedobject-in-library-directory-missing-soname
Severity: important
Certainty: possible
diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
index 3715d8b..29fcc0a 100644
--- a/checks/shared-libs.pm
+++ b/checks/shared-libs.pm
@@ -630,18 +630,26 @@ sub run {
if (my $preinst = $info->control_index_resolved_path('preinst')) {
if ($preinst->is_open_ok) {
if ($preinst->file_contents =~ m/^[^\#]*\bldconfig\b/m) {
- tag 'preinst-calls-ldconfig';
+ tag 'maintscript-calls-ldconfig', 'preinst'
+ # Assume it is needed if glibc does it
+ if $proc->pkg_src ne 'glibc';
}
}
}
- my $we_call_postinst=0;
my $we_trigger_ldconfig = 0;
if (my $postinst = $info->control_index_resolved_path('postinst')) {
if ($postinst->is_open_ok) {
# Decide if we call ldconfig
if ($postinst->file_contents =~ m/^[^\#]*\bldconfig\b/m) {
- $we_call_postinst=1;
+ if ($type eq 'udeb') {
+ tag 'udeb-postinst-must-not-call-ldconfig';
+ } else {
+ # glibc (notably libc-bin) needs to call ldconfig in
+ # order to implement the "ldconfig" trigger.
+ tag 'maintscript-calls-ldconfig', 'postinst'
+ if $proc->pkg_src ne 'glibc';
+ }
}
}
}
@@ -664,7 +672,7 @@ sub run {
if ($type eq 'udeb') {
tag 'udeb-postinst-must-not-call-ldconfig'
- if $we_call_postinst or $we_trigger_ldconfig;
+ if $we_trigger_ldconfig;
} else {
tag 'package-has-unnecessary-activation-of-ldconfig-trigger'
if $we_trigger_ldconfig and not $must_call_ldconfig;
@@ -680,7 +688,9 @@ sub run {
if (my $prerm = $info->control_index_resolved_path('prerm')) {
if ($prerm->is_open_ok) {
if ($prerm->file_contents =~ m/^[^\#]*\bldconfig\b/m) {
- tag 'prerm-calls-ldconfig';
+ tag 'maintscript-calls-ldconfig', 'prerm'
+ # Assume it is needed if glibc does it
+ if $proc->pkg_src ne 'glibc';
}
}
}
@@ -691,26 +701,9 @@ sub run {
# Decide if we call ldconfig
if ($contents =~ m/^[^\#]*\bldconfig\b/m) {
- tag 'postrm-has-useless-call-to-ldconfig',
- unless $must_call_ldconfig;
- } else {
- tag 'postrm-should-call-ldconfig', $must_call_ldconfig
- if $must_call_ldconfig and not $we_trigger_ldconfig;
- }
-
- # Decide if we do it safely
- $contents =~ s/\bldconfig\b/BldconfigB/g;
- $contents =~ s/[ \t]//g;
- # this one matches code from debhelper
- $contents =~ s/^if\["\$1"=.?remove.?\];?\n*then\n*BldconfigB//gm;
- # variations...
- $contents =~ s/^if\[.?remove.?="\$1"\];?\n*then\n*BldconfigB//gm;
- $contents =~ s/^\["\$1"=.?remove.?\]\&&BldconfigB//gm;
- $contents =~ s/^\[.?remove.?="\$1"\]&&BldconfigB//gm;
- $contents =~ s/remove(?:\|[^)]+)*\).*?BldconfigB.*?(?:;;|esac)//s;
-
- if ($contents =~ m/^[^\#]*BldconfigB/m) {
- tag 'postrm-unsafe-ldconfig';
+ tag 'maintscript-calls-ldconfig', 'postrm'
+ # Assume it is needed if glibc does it
+ if $proc->pkg_src ne 'glibc';
}
}
}
diff --git a/debian/changelog b/debian/changelog
index cd61668..c380a6c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,9 @@ lintian (2.5.44) UNRELEASED; urgency=medium
+ [NT] Rename and clarify some ldconfig related tags to better reflect
the use of the ldconfig trigger. Thanks to Rafael Laboissiere for
reporting this. (Closes: #809577)
+ + [NT] Merge and remove some ldconfig related tags. Notably
+ unconditionally flag all uses of ldconfig in maintainer scripts
+ (outside glibc) as these should be replaced by a trigger.
* commands/info.pm:
+ [NT] Accept "--tag" as an alias of "--tags". Thanks to Robert
diff --git a/t/tests/legacy-maintainer-scripts/tags b/t/tests/legacy-maintainer-scripts/tags
index c633187..07ef0c4 100644
--- a/t/tests/legacy-maintainer-scripts/tags
+++ b/t/tests/legacy-maintainer-scripts/tags
@@ -69,6 +69,7 @@ W: maintainer-scripts: maintainer-script-should-not-use-deprecated-chown-usage p
W: maintainer-scripts: maintainer-script-should-not-use-gconftool postinst:68
W: maintainer-scripts: maintainer-script-should-not-use-start-stop-daemon postinst:159
W: maintainer-scripts: maintainer-script-should-not-use-update-alternatives-remove postrm:4
+W: maintainer-scripts: maintscript-calls-ldconfig postrm
W: maintainer-scripts: missing-debconf-dependency
W: maintainer-scripts: no-debconf-templates
W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:108 '${H[@]}'
@@ -164,5 +165,4 @@ W: maintainer-scripts: possibly-insecure-handling-of-tmp-files-in-maintainer-scr
W: maintainer-scripts: possibly-insecure-handling-of-tmp-files-in-maintainer-script postrm:40
W: maintainer-scripts: postinst-does-not-load-confmodule
W: maintainer-scripts: postrm-does-not-purge-debconf
-W: maintainer-scripts: postrm-has-useless-call-to-ldconfig
X: maintainer-scripts: maintainer-script-may-use-dir_to_symlink_helper postinst:5
diff --git a/t/tests/shared-libs-ldconfig-scripts/desc b/t/tests/shared-libs-ldconfig-scripts/desc
index d984d1c..d70a74b 100644
--- a/t/tests/shared-libs-ldconfig-scripts/desc
+++ b/t/tests/shared-libs-ldconfig-scripts/desc
@@ -3,10 +3,6 @@ Sequence: 6000
Version: 1.0
Description: Test checks related to ldconfig in scripts
Test-For:
+ maintscript-calls-ldconfig
package-has-unnecessary-activation-of-ldconfig-trigger
package-must-activate-ldconfig-trigger
- postrm-has-useless-call-to-ldconfig
- postrm-should-call-ldconfig
- postrm-unsafe-ldconfig
- preinst-calls-ldconfig
- prerm-calls-ldconfig
diff --git a/t/tests/shared-libs-ldconfig-scripts/tags b/t/tests/shared-libs-ldconfig-scripts/tags
index bd380f2..aa57738 100644
--- a/t/tests/shared-libs-ldconfig-scripts/tags
+++ b/t/tests/shared-libs-ldconfig-scripts/tags
@@ -1,7 +1,7 @@
E: libfoo1: package-must-activate-ldconfig-trigger usr/lib/libfoo.so.1.0.1
-E: libfoo1: postrm-should-call-ldconfig usr/lib/libfoo.so.1.0.1
+W: app: maintscript-calls-ldconfig postinst
+W: app: maintscript-calls-ldconfig postrm
W: app: package-has-unnecessary-activation-of-ldconfig-trigger
-W: app: postrm-has-useless-call-to-ldconfig
-W: libfish1: preinst-calls-ldconfig
-W: libfish1: prerm-calls-ldconfig
-W: libuns1: postrm-unsafe-ldconfig
+W: libfish1: maintscript-calls-ldconfig preinst
+W: libfish1: maintscript-calls-ldconfig prerm
+W: libuns1: maintscript-calls-ldconfig postrm
diff --git a/t/tests/shared-libs-unversioned/debian/debian/postinst b/t/tests/shared-libs-unversioned/debian/debian/postinst
deleted file mode 100644
index 0f437db..0000000
--- a/t/tests/shared-libs-unversioned/debian/debian/postinst
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# A single library without a versioned SONAME makes dh_makeshlibs think
-# there's nothing to do and hence it doesn't add the ldconfig invocation.
-# Since that's not what we're testing, do it ourselves.
-
-set -e
-
-if [ "$1" = "configure" ] ; then
- ldconfig
-fi
-
-#DEBHELPER#
diff --git a/t/tests/shared-libs-unversioned/debian/debian/postrm b/t/tests/shared-libs-unversioned/debian/debian/postrm
deleted file mode 100644
index 5c269c3..0000000
--- a/t/tests/shared-libs-unversioned/debian/debian/postrm
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# A single library without a versioned SONAME makes dh_makeshlibs think
-# there's nothing to do and hence it doesn't add the ldconfig invocation.
-# Since that's not what we're testing, do it ourselves.
-
-set -e
-
-if [ "$1" = "remove" ] ; then
- ldconfig
-fi
-
-#DEBHELPER#
diff --git a/t/tests/shared-libs-unversioned/debian/debian/triggers b/t/tests/shared-libs-unversioned/debian/debian/triggers
new file mode 100644
index 0000000..dd86603
--- /dev/null
+++ b/t/tests/shared-libs-unversioned/debian/debian/triggers
@@ -0,0 +1 @@
+activate-noawait ldconfig
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: