Author: adsb
Date: 2009-01-02 16:29:35 +0000 (Fri, 02 Jan 2009)
New Revision: 1768
Modified:
trunk/debian/changelog
trunk/scripts/checkbashisms.pl
Log:
checkbashisms: Rework the comment detection code to avoid matching "$#"
and to avoid a number of similar issues. (Closes: #510343)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-12-23 16:37:58 UTC (rev 1767)
+++ trunk/debian/changelog 2009-01-02 16:29:35 UTC (rev 1768)
@@ -3,6 +3,8 @@
[ Adam D. Barratt ]
* bts: Allow an alternative debbugs server to be specified.
(Closes: #508676)
+ * checkbashisms: Rework the comment detection code to avoid matching "$#"
+ and to avoid a number of similar issues. (Closes: #510343)
* Debbugs.pm: Allow the address of the debbugs server to be specified
rather than hard-coding bugs.debian.org.
* debdiff:
Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl 2008-12-23 16:37:58 UTC (rev 1767)
+++ trunk/scripts/checkbashisms.pl 2009-01-02 16:29:35 UTC (rev 1768)
@@ -154,13 +154,15 @@
next if m,^\s*\#,; # skip comment lines
+ # Remove quoted strings so we can more easily ignore comments
+ # inside them
s/(^|[^\\](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
s/(^|[^\\](?:\\\\)*)\"(?:\\.|[^\\\"])+\"/$1""/g;
# If the remaining string contains what looks like a comment,
# eat it. In either case, swap the unmodified script line
# back in for processing.
- if (m/(?<!\\)(\#.*$)/) {
+ if (m/(?:^|[^[\\])[\s\&;\(\)](\#.*$)/) {
$_ = $orig_line;
$_ =~ s/\Q$1\E//; # eat comments
} else {
--
To unsubscribe, send mail to [email protected].