Author: adam-guest
Date: 2008-03-04 20:04:55 +0000 (Tue, 04 Mar 2008)
New Revision: 1100
Modified:
trunk/debian/changelog
trunk/scripts/checkbashisms.pl
Log:
+ Identify and ignore multi-line quoted text (Closes: #464641)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-03-04 07:11:03 UTC (rev 1099)
+++ trunk/debian/changelog 2008-03-04 20:04:55 UTC (rev 1100)
@@ -16,6 +16,7 @@
Geissert for the patch (Closes: #469050)
+ Modify each of the simple shell variable tests (e.g. $RANDOM) to
also match ${variable}
+ + Identify and ignore multi-line quoted text (Closes: #464641)
* 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 07:11:03 UTC (rev 1099)
+++ trunk/scripts/checkbashisms.pl 2008-03-04 20:04:55 UTC (rev 1100)
@@ -76,6 +76,7 @@
}
my $cat_string = "";
+ my $quote_string = "";
while (<C>) {
if ($. == 1) { # This should be an interpreter line
@@ -179,9 +180,33 @@
$bashisms{'echo\s+-[n]'} = 'q<echo -n>';
}
+ my $line = $_;
+
+ if ($quote_string ne "") {
+ # Inside a quoted block
+ if ($line =~ /^.*?[^\\]$quote_string(.*)$/) {
+ # Quoted block ends on this line
+ # Ignore everything before the closing quote
+ $line = $1;
+ $quote_string = "";
+ } else {
+ # Still inside the quoted block, skip this line
+ next;
+ }
+ } elsif ($line =~ /[^\\]([\"\'])\s*$/) {
+ # Possible start of a quoted block
+ my $temp = $1;
+ my $count = () = $line =~ /[^\\]$temp/g;
+
+ # If there's an odd number of non-escaped
+ # quotes in the line and the line ends with
+ # one, it's almost certainly the start of
+ # a quoted block.
+ $quote_string = $temp if ($count % 2 == 1)
+ }
+
# Ignore anything inside single quotes; it could be an
# argument to grep or the like.
- my $line = $_;
$line =~ s/(^|[^\\](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
while (my ($re,$expl) = each %string_bashisms) {
--
To unsubscribe, send mail to [EMAIL PROTECTED]