[SCM] Debian package checker branch, master, updated. b4319c50b453a2799651942039fa1a9876704d4f
The following commit has been merged in the master branch:
commit b4319c50b453a2799651942039fa1a9876704d4f
Author: Adam D. Barratt <adam@adam-barratt.org.uk>
Date: Mon Jul 7 19:05:34 2008 +0100
Improve various bashism checks to remove some false-positives
Don't flag '. "$(dirname $0)/foo"' as a sourced script being passed arguments
Fix a couple of false-positive causing issues with the brace expansion and function name checks
diff --git a/checks/scripts b/checks/scripts
index 87097db..ca1c52c 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -578,7 +578,7 @@ while (<SCRIPTS>) {
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
- qr'[^\\]\{(?:[^\s\\\}]+?,)+[^\\\}\s]+\}', # brace expansion
+ qr'[^\\\$]\{(?:[^\s\\\}]+?,)+[^\\\}\s]+\}', # brace expansion
qr'(?:^|\s+)\w+\[\d+\]=', # bash arrays, H[0]
$LEADIN . qr'(read\s*(-[^r]+)*(?:;|$))',
# read without variable or with option other than -r
@@ -609,7 +609,7 @@ while (<SCRIPTS>) {
$LEADIN . qr'unalias\s+-a', # unalias -a
$LEADIN . qr'local\s+-[a-zA-Z]+', # local -opt
$LEADIN . qr'local\s+\w+=', # local foo=bar
- qr'(?:^|\s+)\s*\(?\w*[^\(\w\s]+\S*?\s*\(\)[^\"]?',
+ qr'(?:^|\s+)\s*\(?\w*[^\(\w\s]+\S*?\s*\(\)\s*([\{|\(]|\Z)',
# function names should only contain [a-z0-9_]
$LEADIN . qr'(push|pop)d(\s|\Z)', # (push|pod)d
$LEADIN . qr'export\s+-[^p]', # export only takes -p as an option
@@ -627,7 +627,11 @@ while (<SCRIPTS>) {
# since this test is ugly, I have to do it by itself
# detect source (.) trying to pass args to the command it runs
- if (not $found and m/^\s*(\.\s+[^\s;\`:]+\s+([^\s;]+))/) {
+ # The first expression weeds out '. "foo bar"'
+ if (not $found and
+ not m/^\s*\.\s+(\"[^\"]+\"|\'[^\']+\')\s*(\&|\||\d?>|<|;|\Z)/
+ and m/^\s*(\.\s+[^\s;\`:]+\s+([^\s;]+))/) {
+
my $extra;
($match, $extra) = ($1, $2);
if ($extra =~ /^(\&|\||\d?>|<)/) {
--
Debian package checker
Reply to: