The following commit has been merged in the master branch:
commit 3a85687f7561224732bec86a6f67a134520cefbd
Author: Raphael Geissert <[email protected]>
Date:   Mon Oct 22 01:48:25 2012 -0500

    checkbashisms: fix handling of # characters in quoted strings
    
    The code that removes comments wasn't taking into consideration open,
    multi-line, quoted strings. In some cases it could remove the closing
    quote character because it considered it to be part of a comment.
    
    Signed-off-by: Benjamin Drung <[email protected]>

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 975f710..c5ec676 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -183,6 +183,12 @@ foreach my $filename (@ARGV) {
        s/(^|[^\\](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
        s/(^|[^\\](?:\\\\)*)\"(?:\\.|[^\\\"])+\"/$1""/g;
 
+       # If inside a quoted string, remove everything before the quote
+       s/^.+?\'//
+           if ($quote_string eq "'");
+       s/^.+?[^\\]\"//
+           if ($quote_string eq '"');
+
        # If the remaining string contains what looks like a comment,
        # eat it. In either case, swap the unmodified script line
        # back in for processing.

-- 
Git repository for devscripts

_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to