pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files Added more code to the shell wo...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4d7726658f44
branches:  trunk
changeset: 517118:4d7726658f44
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Fri Aug 04 18:32:41 2006 +0000

description:
Added more code to the shell word parser so that it can parse variables,
in double quotes or not, inside backticks.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r b75a6d42e514 -r 4d7726658f44 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Fri Aug 04 18:18:43 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Fri Aug 04 18:32:41 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.668 2006/08/01 08:58:49 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.669 2006/08/04 18:32:41 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -4093,12 +4093,11 @@
                        } 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_]+)//) {
+                           || $rest =~ s/^\$\$([0-9A-Z_a-z]+|\$\$|[!#?\@])//) {
                                my ($shvarname) = ($1);
                                if ($opt_warn_quoting && $check_quoting) {
                                        $line->log_warning("Unquoted shell variable \$${shvarname}.");
                                }
-
                        } else {
                                last;
                        }
@@ -4115,7 +4114,14 @@
                } elsif ($state == SWST_BACKT_DQUOT) {
                        if ($rest =~ s/^"//) {
                                $state = SWST_BACKT;
+
                        } elsif ($rest =~ s/^[^\\\"\'\`\$]+//) {
+
+                       } elsif ($rest =~ s/^\\(?:[\\\"\`]|\$\$)//) {
+
+                       } elsif ($rest =~ s/^\$\$\{([0-9A-Za-z_]+)\}//
+                           || $rest =~ s/^\$\$([0-9A-Z_a-z]+|\$\$|[!#?\@])//) {
+                               my ($shvarname) = ($1);
                        } else {
                                last;
                        }



Home | Main Index | Thread Index | Old Index