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

[SCM] Debian package checker branch, master, updated. 2.3.4-36-g70d0e93



The following commit has been merged in the master branch:
commit 70d0e934ec5f1852f5f957b8bf44d378d2072397
Author: Russ Allbery <rra@debian.org>
Date:   Thu Mar 25 15:33:46 2010 -0700

    Recognize negated tests when checking init script sourcing
    
    * checks/init.d:
      + [RA] Recognize negated file checks when checking for file sourcing
        without a test.  Thanks, Jérémie Corbier.  (Closes: #575363)

diff --git a/checks/init.d b/checks/init.d
index e456308..d24daf3 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -255,7 +255,7 @@ sub check_init {
 
 	# Pretty dummy way to handle conditionals, but should be enough
 	# for simple init scripts
-	$in_file_test = 1 if ($l =~ m/\bif\s+.*?(?:test|\[)\s+-[efr]\s+/);
+	$in_file_test = 1 if ($l =~ m/\bif\s+.*?(?:test|\[)(?:\s+\!)?\s+-[efr]\s+/);
 	$in_file_test = 0 if ($l =~ m/\bfi\b/);
 	if (!$in_file_test && $l =~ m,^\s*\.\s+["'"]?(/etc/default/[\$\w/-]+),) {
 	    tag "init.d-script-sourcing-without-test", "/etc/init.d/$_:$. $1";
diff --git a/debian/changelog b/debian/changelog
index a406140..c50bfc2 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ lintian (2.4.0) UNRELEASED; urgency=low
     + [RA] Allow $all to satisfy a $remote_fs or $local_fs requirement for
       Required-Stop, since this has now been implemented.  Thanks, Michael
       Meskes.
+    + [RA] Recognize negated file checks when checking for file sourcing
+      without a test.  Thanks, Jérémie Corbier.  (Closes: #575363)
   * checks/lintian.desc:
     + [ADB] Remove information about .changes-related tags, now included in
       checks/changes-file.desc
diff --git a/t/tests/init.d-general/debian/debian/init.d-general-sourcing-without-test.init b/t/tests/init.d-general/debian/debian/init.d-general-sourcing-without-test.init
index 1b946e3..378be9f 100644
--- a/t/tests/init.d-general/debian/debian/init.d-general-sourcing-without-test.init
+++ b/t/tests/init.d-general/debian/debian/init.d-general-sourcing-without-test.init
@@ -40,3 +40,11 @@ fi
 if test -f /etc/default/$PACKAGE; then
     . /etc/default/$PACKAGE
 fi
+
+# This is not sourcing without a test and shouldn't produce an error.
+if [ ! -f /etc/default/$PACKAGE ] ; then
+    # do something else
+    :
+else
+    . /etc/default/$PACKAGE
+fi

-- 
Debian package checker


Reply to: