summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-01-12 13:19:57 +0000
committerrillig <rillig@pkgsrc.org>2006-01-12 13:19:57 +0000
commit9af416c16b183c45968222cf5aa900f1c9ea29b9 (patch)
treec17cbcef8b62f3f8a871c19aadc39abdbb9e9191 /pkgtools
parent942439b52ad7220c0ef20a188ea797bc0a4778c5 (diff)
downloadpkgsrc-9af416c16b183c45968222cf5aa900f1c9ea29b9.tar.gz
- The shell variables $!, $# and $? are recognized as such. All other
occurences of a $ in double quoted strings result in a warning.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 3b6aa438218..8bc962d618a 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
-#! @PERL@ -w
-# $NetBSD: pkglint.pl,v 1.467 2006/01/12 13:01:47 rillig Exp $
+#! @PERL@
+# $NetBSD: pkglint.pl,v 1.468 2006/01/12 13:19:57 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -27,6 +27,8 @@
# ages must be in a BEGIN block, because otherwise the names starting with
# an uppercase letter are not recognized as subroutines but as file handles.
#==========================================================================
+use strict;
+use warnings;
package PkgLint::Util;
#==========================================================================
@@ -2045,9 +2047,11 @@ sub checkline_mk_shellword($$$) {
} elsif ($rest =~ s/^[^\$"\\\`]//) {
} elsif ($rest =~ s/^\\(?:[\\\"\`]|\$\$)//) {
} elsif ($rest =~ s/^\$\$\{([0-9A-Za-z_]+)\}//
- || $rest =~ s/^\$\$([0-9A-Za-z_]+)//) {
+ || $rest =~ s/^\$\$([0-9A-Z_a-z]+|[!#?])//) {
my ($varname) = ($1);
$line->log_debug("[checkline_mk_shellword] Found double-quoted variable ${varname}.");
+ } elsif ($rest =~ s/^\$\$//) {
+ $line->log_warning("Unquoted \$ or strange shell variable found.");
} elsif ($rest =~ s/^\\([\(\)*.0-9n])//) {
my ($char) = ($1);
$line->log_warning("Please use \"\\\\${char}\" instead of \"\\${char}\".");