Author: adam-guest
Date: 2008-03-17 21:54:38 +0000 (Mon, 17 Mar 2008)
New Revision: 1164

Modified:
   trunk/debian/changelog
   trunk/scripts/checkbashisms.pl
Log:
  + Enhance "shell script wrapper" detection to catch more ways of
    disguising a non shell script as one

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-03-17 21:29:53 UTC (rev 1163)
+++ trunk/debian/changelog      2008-03-17 21:54:38 UTC (rev 1164)
@@ -10,7 +10,9 @@
       before the function name
     + Don't treat '' at the beginning of a line as the start of a quoted block
     + Allow a heredoc marker to begin with a backslash
-    + Enhance quoted block detection to handle escaped quotes better 
+    + Enhance quoted block detection to handle escaped quotes better
+    + Enhance "shell script wrapper" detection to catch more ways of
+      disguising a non shell script as one
 
  -- Adam D. Barratt <[EMAIL PROTECTED]>  Sun, 16 Mar 2008 19:40:40 +0000
 

Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl      2008-03-17 21:29:53 UTC (rev 1163)
+++ trunk/scripts/checkbashisms.pl      2008-03-17 21:54:38 UTC (rev 1164)
@@ -341,17 +341,19 @@
     # itself
     open (IN, '<', $filename) or return;
     my $i = 0;
+    my $var = "0";
     local $_;
     while (<IN>) {
         chomp;
         next if /^#/o;
         next if /^$/o;
-        last if (++$i > 20);
-
-        if 
(/(^\s*|\beval\s*\'|;\s*)exec\s*.+\s*.?\$0.?\s*(--\s*)?.?(\${1:?\+)?\$(\@|\*)/o)
 {
+        last if (++$i > 55);
+        if 
((/^\s*|\beval\s*[\'\"]|;\s*)exec\s*.+\s*.?\$$var.?\s*(--\s*)?.?(\${1:?\+)?\$(\@|\*)/)
 {
             $ret = 1;
             last;
-        }
+        } elsif (/^\s*(\w+)=\$0;/) {
+           $var = $1;
+       }
     }
     close IN;
     return $ret;



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to