Author: jamessan
Date: 2009-11-28 21:47:03 +0000 (Sat, 28 Nov 2009)
New Revision: 2043
Modified:
trunk/debian/changelog
trunk/scripts/checkbashisms.pl
Log:
checkbashisms: Fix a false positive detection of ". $(foo bar)/baz" as
attempting to pass arguments to a sourced script. (Closes: #557639)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2009-11-28 21:05:54 UTC (rev 2042)
+++ trunk/debian/changelog 2009-11-28 21:47:03 UTC (rev 2043)
@@ -2,6 +2,8 @@
* debrelease: Do not use .svn/deb-layout to determine debsdir if --debs-dir
was used. (Closes: #558172)
+ * checkbashisms: Fix a false positive detection of ". $(foo bar)/baz" as
+ attempting to pass arguments to a sourced script. (Closes: #557639)
-- James Vega <[email protected]> Sat, 28 Nov 2009 16:04:37 -0500
Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl 2009-11-28 21:05:54 UTC (rev 2042)
+++ trunk/scripts/checkbashisms.pl 2009-11-28 21:47:03 UTC (rev 2043)
@@ -94,7 +94,7 @@
. "$check_lines_count lines\n";
}
- unless (open C, "$filename") {
+ unless (open C, '<', $filename) {
warn "cannot open script $filename for reading: $!\n";
$status |= 2;
next;
@@ -282,7 +282,7 @@
# detect source (.) trying to pass args to the command it runs
# The first expression weeds out '. "foo bar"'
if (not $found and
- not
m/$LEADIN\.\s+(\"[^\"]+\"|\'[^\']+\'|\$\([^)]+\)+)\s*(\&|\||\d?>|<|;|\Z)/
+ not
m/$LEADIN\.\s+(\"[^\"]+\"|\'[^\']+\'|\$\([^)]+\)+(?:\/[^\s;]+)?)\s*(\&|\||\d?>|<|;|\Z)/
and m/$LEADIN(\.\s+[^\s;\`:]+\s+([^\s;]+))/) {
if ($2 =~ /^(\&|\||\d?>|<)/) {
# everything is ok
@@ -561,7 +561,7 @@
$bashisms{$LEADIN . qr'\w+\+='} = q<should be VAR="${VAR}foo">;
$string_bashisms{qr'(\$\(|\`)\s*\<\s*\S+\s*(\)|\`)'} = q<'$(\< foo)'
should be '$(cat foo)'>;
}
-
+
if ($opt_extra) {
$string_bashisms{qr'\$\{?BASH\}?\b'} = q<$BASH>;
$string_bashisms{qr'(?:^|\s+)RANDOM='} = q<RANDOM=>;
--
To unsubscribe, send mail to [email protected].