[SCM] Git repository for devscripts branch, master, updated. v2.12.4-43-g227b8b8

Benjamin Drung bdrung at debian.org
Thu Oct 25 20:17:08 UTC 2012


The following commit has been merged in the master branch:
commit 3a85687f7561224732bec86a6f67a134520cefbd
Author: Raphael Geissert <geissert at debian.org>
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 <bdrung at debian.org>

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



More information about the devscripts-devel mailing list