lintian: r893 - in trunk: checks debian testset testset/maintainer-scripts/debian
Author: rra
Date: 2007-06-04 05:45:17 +0200 (Mon, 04 Jun 2007)
New Revision: 893
Modified:
trunk/checks/scripts
trunk/checks/scripts.desc
trunk/debian/changelog
trunk/testset/maintainer-scripts/debian/postinst
trunk/testset/tags.maintainer-scripts
Log:
+ [RA] Diagnose maintainer scripts looking at /var/lib/dpkg/status
directly. Thanks, Guillem Jover. (Closes: #426628)
Modified: trunk/checks/scripts
===================================================================
--- trunk/checks/scripts 2007-06-04 03:29:18 UTC (rev 892)
+++ trunk/checks/scripts 2007-06-04 03:45:17 UTC (rev 893)
@@ -629,9 +629,12 @@
}
}
}
- if (/\bgconftool(-2)?(\s|\Z)/) {
+ if (m,\bgconftool(-2)?(\s|\Z),) {
tag "gconftool-used-in-maintainer-script", "$file:$.";
}
+ if (m,/var/lib/dpkg/status\b, && $pkg ne 'base-files' && $pkg ne 'dpkg') {
+ tag "maintainer-script-uses-dpkg-status-directly", "$file";
+ }
}
if ($saw_init && ! $saw_invoke) {
Modified: trunk/checks/scripts.desc
===================================================================
--- trunk/checks/scripts.desc 2007-06-04 03:29:18 UTC (rev 892)
+++ trunk/checks/scripts.desc 2007-06-04 03:45:17 UTC (rev 893)
@@ -376,3 +376,16 @@
Type: warning
Info: This script apparently runs gconftool or gconftool-2. It should
probably be calling gconf-schemas or update-gconf-defaults instead.
+
+Tag: maintainer-script-uses-dpkg-status-directly
+Type: error
+Info: The file /var/lib/dpkg/status is internal to dpkg, may disappear or
+ change formats, and is not always a correct and complete record of
+ installed packages while dpkg is running. Maintainer scripts should use
+ dpkg-query instead. For the most common case of retrieving conffile
+ information, use:
+ .
+ dpkg-query -W -f='${Conffiles}' <package>
+ .
+ instead.
+Ref: http://wiki.debian.org/DpkgConffileHandling
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-06-04 03:29:18 UTC (rev 892)
+++ trunk/debian/changelog 2007-06-04 03:45:17 UTC (rev 893)
@@ -35,11 +35,13 @@
+ [RA] Move several maintainer script checks specific to shell scripts
inside the conditional so that they won't run on maintainer scripts
not written in shell.
+ + [RA] Diagnose maintainer scripts looking at /var/lib/dpkg/status
+ directly. Thanks, Guillem Jover. (Closes: #426628)
* frontend/lintian-info:
+ [CW] Fix uninitialized value warning after reading a blank line.
- -- Russ Allbery <rra@debian.org> Sun, 03 Jun 2007 20:27:18 -0700
+ -- Russ Allbery <rra@debian.org> Sun, 03 Jun 2007 20:45:13 -0700
lintian (1.23.30) unstable; urgency=low
Modified: trunk/testset/maintainer-scripts/debian/postinst
===================================================================
--- trunk/testset/maintainer-scripts/debian/postinst 2007-06-04 03:29:18 UTC (rev 892)
+++ trunk/testset/maintainer-scripts/debian/postinst 2007-06-04 03:45:17 UTC (rev 893)
@@ -73,3 +73,8 @@
# Calling update-xmlcatalog with no dependency.
update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \
--package maintainer-scripts --root
+
+# Maintainer scripts shouldn't touch /var/lib/dpkg/status. This is the old
+# recipe from the dpkg wiki that should be replaced with dpkg-query.
+sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \
+ /var/lib/dpkg/status
Modified: trunk/testset/tags.maintainer-scripts
===================================================================
--- trunk/testset/tags.maintainer-scripts 2007-06-04 03:29:18 UTC (rev 892)
+++ trunk/testset/tags.maintainer-scripts 2007-06-04 03:45:17 UTC (rev 893)
@@ -10,6 +10,7 @@
E: maintainer-scripts: maintainer-script-does-not-check-for-existence-of-wm-menu-config postinst:31
E: maintainer-scripts: maintainer-script-removes-device-files postrm:39
E: maintainer-scripts: maintainer-script-removes-device-files postrm:40
+E: maintainer-scripts: maintainer-script-uses-dpkg-status-directly postinst
E: maintainer-scripts: maintainer-shell-script-fails-syntax-check prerm
E: maintainer-scripts: no-copyright-file
E: maintainer-scripts: postrm-contains-additional-updaterc.d-calls /etc/init.d/bar
Reply to: