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

lintian: r535 - / trunk/checks trunk/debian trunk/testset trunk/testset/maintainer-scripts/debian



Author: djpig
Date: 2006-01-04 16:20:24 +0100 (Wed, 04 Jan 2006)
New Revision: 535

Added:
   trunk/testset/maintainer-scripts/debian/preinst
Modified:
   /
   trunk/checks/init.d
   trunk/debian/changelog
   trunk/testset/maintainer-scripts/debian/postinst
   trunk/testset/maintainer-scripts/debian/postrm
   trunk/testset/maintainer-scripts/debian/prerm
   trunk/testset/maintainer-scripts/debian/rules
   trunk/testset/tags.maintainer-scripts
Log:
 r540@djpigpb:  djpig | 2006-01-04 16:04:37 +0100
 Only try to validate update-rc.d calls where the name of the
 script matches [\w.-]+. That accounts for all today known init
 scripts and eliminates false postives like shell variables in the
 name (Closes: #343865)



Property changes on: 
___________________________________________________________________
Name: svk:merge
   + c3d60771-8809-0410-bd80-fb025018a7e6:/local/lintian:540

Modified: trunk/checks/init.d
===================================================================
--- trunk/checks/init.d	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/checks/init.d	2006-01-04 15:20:24 UTC (rev 535)
@@ -38,12 +38,18 @@
 my %initd_postrm;
 my %conffiles;
 
+my $opts_r = qr/-\S+\s*/;
+my $name_r = qr/[\w.-]+/;
+my $action_r = qr/\w+/;
+my $exclude_r = qr/if\s+\[\s+-x\s+\S*update-rc\.d/;
+
 # read postinst control file
 if (open(IN,$postinst)) {
     while (<IN>) {
-	next if m/if\s+\[\s+-x\s+\S*update-rc\.d/o;
+	next if /$exclude_r/o;
 	s/\#.*$//o;
-	next unless /^(?:.+;)?\s*update-rc\.d\s+(?:-\S+\s*)*(\S+)\s+(\S+)/;
+	next unless /^(?:.+;)?\s*update-rc\.d\s+
+	    (?:$opts_r)*($name_r)\s+($action_r)/xo;
 	my ($name,$opt) = ($1,$2);
 	next if $opt eq 'remove';
 	if ($initd_postinst{$name}++ == 1) {
@@ -60,9 +66,9 @@
 # read preinst control file
 if (open(IN,$preinst)) {
     while (<IN>) {
-	next if m/if\s+\[\s+-x\s+\S*update-rc\.d/o;
+	next if /$exclude_r/o;
 	s/\#.*$//o;
-	next unless m/update-rc\.d\s+(?:-\S+\s*)*(\S+)\s+(\S+)/o;
+	next unless m/update-rc\.d\s+(?:$opts_r)*($name_r)\s+($action_r)/o;
 	my ($name,$opt) = ($1,$2);
 	next if $opt eq 'remove';
 	tag "preinst-calls-updaterc.d", "$name";
@@ -73,9 +79,9 @@
 # read postrm control file
 if (open(IN,$postrm)) {
     while (<IN>) {
-	next if m/if\s+\[\s+-x\s+\S*update-rc\.d/o;
+	next if /$exclude_r/o;
 	s/\#.*$//o;
-	next unless m/update-rc\.d\s+(-\S+\s*)*(\S+)/;
+	next unless m/update-rc\.d\s+($opts_r)*($name_r)/o;
 	if ($initd_postrm{$2}++ == 1) {
 	    tag "duplicate-updaterc.d-calls-in-postrm", "$2";
 	    next;
@@ -90,9 +96,9 @@
 # read prerm control file
 if (open(IN,$prerm)) {
     while (<IN>) {
-	next if m/if\s+\[\s+-x\s+\S*update-rc\.d/o;
+	next if /$exclude_r/o;
 	s/\#.*$//o;
-	next unless m/update-rc\.d\s+(-\S+\s*)*(\S+)/;
+	next unless m/update-rc\.d\s+($opts_r)*($name_r)/o;
 	tag "prerm-calls-updaterc.d", "$2";
     }
     close(IN);

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/debian/changelog	2006-01-04 15:20:24 UTC (rev 535)
@@ -17,8 +17,13 @@
       a patch by Russ Allbery (Closes: #344609, #321135, #339750)
   * checks/fields.desc:
     + [JvW] Fix typo in description
+  * checks/init.d:
+    + [FL] Only try to validate update-rc.d calls where the name of the
+      script matches [\w.-]+. That accounts for all today known init
+      scripts and eliminates false postives like shell variables in the
+      name (Closes: #343865)
 
- -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl>  Sun, 18 Dec 2005 03:40:15 +0100
+ -- Frank Lichtenheld <djpig@debian.org>  Wed,  4 Jan 2006 16:02:50 +0100
 
 lintian (1.23.14) unstable; urgency=low
   

Modified: trunk/testset/maintainer-scripts/debian/postinst
===================================================================
--- trunk/testset/maintainer-scripts/debian/postinst	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/maintainer-scripts/debian/postinst	2006-01-04 15:20:24 UTC (rev 535)
@@ -32,3 +32,8 @@
 
 chown root.root /usr/share/doc/maintainer-scripts/changelog
 chown root:root /usr/share/doc/maintainer-scripts/changelog
+
+$FOO=bar
+update-rc.d foo defaults >/dev/null
+update-rc.d $FOO defaults
+update-rc.d foo remove

Modified: trunk/testset/maintainer-scripts/debian/postrm
===================================================================
--- trunk/testset/maintainer-scripts/debian/postrm	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/maintainer-scripts/debian/postrm	2006-01-04 15:20:24 UTC (rev 535)
@@ -18,3 +18,5 @@
 fi
 
 [ "remove" ="$1" ] && ldconfig
+
+update-rc.d bar remove

Added: trunk/testset/maintainer-scripts/debian/preinst
===================================================================
--- trunk/testset/maintainer-scripts/debian/preinst	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/maintainer-scripts/debian/preinst	2006-01-04 15:20:24 UTC (rev 535)
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+update-rc.d foo remove
+update-rc.d bar defaults

Modified: trunk/testset/maintainer-scripts/debian/prerm
===================================================================
--- trunk/testset/maintainer-scripts/debian/prerm	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/maintainer-scripts/debian/prerm	2006-01-04 15:20:24 UTC (rev 535)
@@ -38,3 +38,5 @@
 if test -n $(echo foo | perl -pe 's/[[:space:]]//go'); then
     echo 1
 fi
+
+update-rc.d foo remove

Modified: trunk/testset/maintainer-scripts/debian/rules
===================================================================
--- trunk/testset/maintainer-scripts/debian/rules	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/maintainer-scripts/debian/rules	2006-01-04 15:20:24 UTC (rev 535)
@@ -7,6 +7,8 @@
 binary-indep:
 	install -d debian/tmp/DEBIAN
 	cp debian/config debian/tmp/DEBIAN
+	cp debian/preinst debian/tmp/DEBIAN
+	chmod +x debian/tmp/DEBIAN/preinst
 	cp debian/postinst debian/tmp/DEBIAN
 	chmod +x debian/tmp/DEBIAN/postinst
 	cp debian/prerm debian/tmp/DEBIAN

Modified: trunk/testset/tags.maintainer-scripts
===================================================================
--- trunk/testset/tags.maintainer-scripts	2006-01-04 14:41:10 UTC (rev 534)
+++ trunk/testset/tags.maintainer-scripts	2006-01-04 15:20:24 UTC (rev 535)
@@ -4,11 +4,17 @@
 E: maintainer-scripts: debconf-config-not-executable
 E: maintainer-scripts: debian-changelog-file-contains-invalid-email-address jeroen@mordor
 E: maintainer-scripts: forbidden-config-interpreter #!/usr/bin/python
+E: maintainer-scripts: init.d-script-not-included-in-package /etc/init.d/foo
 E: maintainer-scripts: interpreter-without-predep control/config #!/usr/bin/python
 E: maintainer-scripts: maintainer-script-does-not-check-for-existence-of-wm-menu-config postinst:31
 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
+E: maintainer-scripts: postrm-does-not-call-updaterc.d-for-init.d-script /etc/init.d/foo
+E: maintainer-scripts: preinst-calls-updaterc.d bar
+E: maintainer-scripts: prerm-calls-updaterc.d foo
 E: maintainer-scripts: wrong-debian-qa-group-name QA group <packages@qa.debian.org>
+I: maintainer-scripts: output-of-updaterc.d-not-redirected-to-dev-null bar postrm
 I: maintainer-scripts: possible-non-posix-code-in-maintainer-script postinst:4 '[ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a '
 I: maintainer-scripts: possible-non-posix-code-in-maintainer-script prerm:25 '   local '
 W: maintainer-scripts source: ancient-standards-version 3.1.1
@@ -16,6 +22,7 @@
 W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7-0.1
 W: maintainer-scripts: config-does-not-load-confmodule
 W: maintainer-scripts: deprecated-chown-usage postinst:33 'chown root.root'
+W: maintainer-scripts: init.d-script-not-marked-as-conffile /etc/init.d/foo
 W: maintainer-scripts: maintainer-script-calls-deprecated-wm-menu-config postinst:31
 W: maintainer-scripts: missing-debconf-dependency
 W: maintainer-scripts: no-debconf-templates



Reply to: