Author: adam-guest
Date: 2008-03-04 22:54:37 +0000 (Tue, 04 Mar 2008)
New Revision: 1101

Modified:
   trunk/debian/changelog
   trunk/scripts/checkbashisms.pl
Log:
  + Reorder a couple of checks so that ". foo $HOSTNAME" is detected as
    source passing arguments rather than misuse of $HOSTNAME

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-03-04 20:04:55 UTC (rev 1100)
+++ trunk/debian/changelog      2008-03-04 22:54:37 UTC (rev 1101)
@@ -17,6 +17,8 @@
     + Modify each of the simple shell variable tests (e.g. $RANDOM) to
       also match ${variable}
     + Identify and ignore multi-line quoted text (Closes: #464641)
+    + Reorder a couple of checks so that ". foo $HOSTNAME" is detected as
+      source passing arguments rather than misuse of $HOSTNAME
   * bts: Allow the sendmail command to begin with a ~ (Closes: #469207)
   * debcommit: Set $SVKDIFF before calling "svk diff" (Closes: #469238)
 

Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl      2008-03-04 20:04:55 UTC (rev 1100)
+++ trunk/scripts/checkbashisms.pl      2008-03-04 22:54:37 UTC (rev 1101)
@@ -205,18 +205,6 @@
                $quote_string = $temp if ($count % 2 == 1)
            }
 
-           # Ignore anything inside single quotes; it could be an
-           # argument to grep or the like.
-           $line =~ s/(^|[^\\](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
-
-           while (my ($re,$expl) = each %string_bashisms) {
-               if ($line =~ m/($re)/) {
-                   $found = 1;
-                   $match = $1;
-                   $explanation = $expl;
-                   last;
-               }
-           }
            # since this test is ugly, I have to do it by itself
            # detect source (.) trying to pass args to the command it runs
            if (not $found and m/^\s*(\.\s+[^\s;\`]+\s+([^\s;]+))/) {
@@ -230,6 +218,19 @@
                }
            }
 
+           # Ignore anything inside single quotes; it could be an
+           # argument to grep or the like.
+           $line =~ s/(^|[^\\](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
+
+           while (!$found and my ($re,$expl) = each %string_bashisms) {
+               if ($line =~ m/($re)/) {
+                   $found = 1;
+                   $match = $1;
+                   $explanation = $expl;
+                   last;
+               }
+           }
+
            # We've checked for all the things we still want to notice in
            # double-quoted strings, so now remove those strings as well.
            unless ($found) {



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

Reply via email to