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

[SCM] Debian package checker branch, master, updated. 71f6ea6f0501394d2e44839ab6b28c485803dab8



The following commit has been merged in the master branch:
commit 71f6ea6f0501394d2e44839ab6b28c485803dab8
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date:   Mon Jul 7 18:20:19 2008 +0100

    Match shell script wrappers which use "foo $0 $@ &\nexec true\n"

diff --git a/checks/scripts b/checks/scripts
index e4c12cd..87097db 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -821,6 +821,7 @@ sub script_is_evil_and_wrong {
     open (IN, '<', $filename) or fail("cannot open $filename: $!");
     my $i = 0;
     my $var = "0";
+    my $backgrounded = 0;
     local $_;
     while (<IN>) {
 	chomp;
@@ -853,6 +854,24 @@ sub script_is_evil_and_wrong {
 	    last;
 	} elsif (/^\s*(\w+)=\$0;/) {
 	    $var = $1;
+	} elsif (m~
+	    # Match scripts which use "foo $0 $@ &\nexec true\n"
+	    # Program name
+	    \S+\s+
+
+	    # As above
+	    .?\$$var.?\s*
+	    (--\s*)?
+	    .?(\${1:?\+.?)?(\$(\@|\*))?.?\s*\&~x) {
+
+	    $backgrounded = 1;
+	} elsif ($backgrounded and m~
+	    # the exec should either be "eval"ed or a new statement
+	    (^\s*|\beval\s*[\'\"]|(;|&&)\s*)
+	    exec\s+true(\s|\Z)~x) {
+
+	    $ret = $1;
+	    last;
 	}
     }
     close IN;

-- 
Debian package checker


Reply to: