summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2006-01-17 23:01:17 +0000
committerrillig <rillig>2006-01-17 23:01:17 +0000
commit48a53ac4d45d5f2191ce22a5fee8e40e64dc936e (patch)
tree4b45f63f546024e041788525f98a4ab01d341c75 /pkgtools
parentdf65ebf51db31429f2f1cb97cb516439dbad298c (diff)
downloadpkgsrc-48a53ac4d45d5f2191ce22a5fee8e40e64dc936e.tar.gz
- Added some more state transitions and warnings to the shellword parser.
It has come to the point where almost any further improvement means to adopt a real recursive parser.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl26
1 files changed, 25 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 2a41b7c3368..96601b35013 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.476 2006/01/16 01:37:39 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.477 2006/01/17 23:01:17 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -2174,6 +2174,13 @@ sub checkline_mk_shellword($$$) {
if ($rest =~ s/^\`//) {
$state = SWST_PLAIN;
} elsif ($rest =~ s/^[^\\\"\'\`\$]+//) {
+ } elsif ($rest =~ s/^'//) {
+ $state = SWST_BACKT_SQUOT;
+ } elsif ($rest =~ s/^"//) {
+ $state = SWST_BACKT_DQUOT;
+ } elsif ($rest =~ s/^\\[\\\$\`]//) {
+ } elsif ($rest =~ s/^\\//) {
+ $line->log_warning("Backslashes should be doubled inside backticks.");
} elsif ($rest =~ s/^\$\$\{([0-9A-Za-z_]+)\}//
|| $rest =~ s/^\$\$([0-9A-Za-z_]+)//) {
my ($shvarname) = ($1);
@@ -2185,6 +2192,23 @@ sub checkline_mk_shellword($$$) {
last;
}
+ } elsif ($state == SWST_BACKT_SQUOT) {
+ if ($rest =~ s/^'//) {
+ $state = SWST_BACKT;
+ } elsif ($rest =~ s/^\\[\\\`\$]//) {
+ } elsif ($rest =~ s/^[^\\]+//) {
+ } else {
+ last;
+ }
+
+ } elsif ($state == SWST_BACKT_DQUOT) {
+ if ($rest =~ s/^"//) {
+ $state = SWST_BACKT;
+ } elsif ($rest =~ s/^[^\\\"\'\`\$]+//) {
+ } else {
+ last;
+ }
+
} else {
last;
}