The following commit has been merged in the master branch:
commit d6ac8bf38340dae035d62880930a77fb1b6129bc
Author: Adam D. Barratt <[email protected]>
Date:   Fri Jan 2 18:47:04 2009 +0000

    Flag the source bashism when its argument is quoted.

diff --git a/checks/scripts b/checks/scripts
index 146249c..aae51e8 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -615,6 +615,8 @@ while (<SCRIPTS>) {
                my @bashism_single_quote_regexs = (
                  $LEADIN . 
qr'echo\s+(?:-[^e\s]+\s+)?\'[^\']*(\\[\\abcEfnrtv0])+.*?[\']',
                        # unsafe echo with backslashes
+                 $LEADIN . qr'source\s+[\"\']?(?:\.\/|\/|\$)[^\s]+',
+                       # should be '.', not 'source'
                );
                my @bashism_string_regexs = (
                  qr'\$\[\w+\]',                 # arith not allowed
@@ -641,8 +643,6 @@ while (<SCRIPTS>) {
                );
                my @bashism_regexs = (
                  qr'(?:^|\s+)function \w+(\s|\(|\Z)',  # function is useless
-                                                # should be '.', not 'source'
-                 $LEADIN . qr'source\s+(?:\.\/|\/|\$)[^\s]+',
                  qr'(test|-o|-a)\s*[^\s]+\s+==\s', # should be 'b = a'
                  qr'\[\s+[^\]]+\s+==\s',        # should be 'b = a'
                  qr'\s(\|\&)',                  # pipelining is not POSIX
diff --git a/debian/changelog b/debian/changelog
index 48f2e3a..ee585c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -93,6 +93,7 @@ lintian (2.1.4) UNRELEASED; urgency=low
     + [ADB] More intelligently remove comments from shell scripts, to avoid
       removing some constructs that aren't comments, such as those in
       [ $# -gt 2 ] and "foo # bar".
+    + [ADB] Flag the source bashism when its argument is quoted.
   * checks/watch-file:
     + [RA] Recognize additional SourceForge URLs and recommend the
       redirector.  Thanks, Riccardo Stagni.  (Closes: #510398)
diff --git a/testset/maintainer-scripts/debian/prerm 
b/testset/maintainer-scripts/debian/prerm
index 512169c..88f2c7c 100644
--- a/testset/maintainer-scripts/debian/prerm
+++ b/testset/maintainer-scripts/debian/prerm
@@ -181,3 +181,6 @@ read -p "Would you like to restart the service?" foo bar
 read --fish
 
 set -e
+
+source "$BAR"
+source '$BAR'
diff --git a/testset/tags.maintainer-scripts b/testset/tags.maintainer-scripts
index 314a269..1debc3f 100644
--- a/testset/tags.maintainer-scripts
+++ b/testset/tags.maintainer-scripts
@@ -115,6 +115,8 @@ W: maintainer-scripts: 
possible-bashism-in-maintainer-script prerm:171 'foobar@(
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:179 'read 
-r'
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:180 'read 
-p'
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:181 'read 
--fish'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:185 'source 
"$BAR"'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:186 'source 
'$BAR''
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:19 '[ "$2" 
== '
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:23 
'function foo('
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:26 '&>'

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to