The following commit has been merged in the master branch:
commit 18274b836d6eb7a8f2f54a01a3c0cf80113b11ac
Author: Adam D. Barratt <[email protected]>
Date:   Wed Jul 1 19:07:13 2009 +0100

    Improve detection of the "source" bashism
    
    + [ADB] Detect the use of the "source" bashism when the sourced filename
      contains a tilde or consists of a single character.  Thanks, Raphael
      Geissert and Ryan Niebur.

diff --git a/checks/scripts b/checks/scripts
index 18c8067..2cc2e70 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -196,7 +196,7 @@ our $LEADIN = 
qr'(?:(?:^|[`&;(|{])\s*|(?:if|then|do|while)\s+)';
 our @bashism_single_quote_regexs = (
     $LEADIN . qr'echo\s+(?:-[^e\s]+\s+)?\'[^\']*(\\[abcEfnrtv0])+.*?[\']',
        # unsafe echo with backslashes
-    $LEADIN . qr'source\s+[\"\']?(?:\.\/|\/|\$|[\w.-])[^\s]+',
+    $LEADIN . qr'source\s+[\"\']?(?:\.\/|\/|\$|[\w~.-])\S*',
        # should be '.', not 'source'
 );
 our @bashism_string_regexs = (
diff --git a/debian/changelog b/debian/changelog
index 2ceace2..52be0a3 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,9 @@ lintian (2.2.13) UNRELEASED; urgency=low
       mention false positives.  Thanks, Raphaƫl Hertzog.  (Closes: #534276)
     + [RA] Allow for output redirection when parsing diversions in
       maintainer scripts.  Thanks, Andreas Beckmann.  (Closes: #534942)
+    + [ADB] Detect the use of the "source" bashism when the sourced filename
+      contains a tilde or consists of a single character.  Thanks, Raphael
+      Geissert and Ryan Niebur.
 
   * collection/strings:
     + [ADB] Handle the fact that, when Lintian is run as root, the output of
diff --git a/testset/maintainer-scripts/debian/prerm 
b/testset/maintainer-scripts/debian/prerm
index 88f2c7c..076ecaf 100644
--- a/testset/maintainer-scripts/debian/prerm
+++ b/testset/maintainer-scripts/debian/prerm
@@ -184,3 +184,5 @@ set -e
 
 source "$BAR"
 source '$BAR'
+source ~/bar
+source a
diff --git a/testset/tags.maintainer-scripts b/testset/tags.maintainer-scripts
index 5c1f92b..e379149 100644
--- a/testset/tags.maintainer-scripts
+++ b/testset/tags.maintainer-scripts
@@ -128,6 +128,8 @@ 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:187 'source 
~/bar'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:188 'source 
a'
 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