pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - In shell variable assignments...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9eb63cd46fff
branches:  trunk
changeset: 506989:9eb63cd46fff
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Jan 24 20:26:11 2006 +0000

description:
- In shell variable assignments, no quoting is needed.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 3a545583d3af -r 9eb63cd46fff pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Jan 24 20:23:19 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Jan 24 20:26:11 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.482 2006/01/24 20:07:54 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.483 2006/01/24 20:26:11 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -1102,6 +1102,7 @@
 use constant regex_unresolved  => qr"\$\{";
 use constant regex_validchars  => qr"[\011\040-\176]";
 use constant regex_varassign   => qr"^([-*+A-Z_a-z0-9.\${}\[]+?)\s*(=|\?=|\+=|:=|!=)\s*((?:\\#|[^#])*?)(?:\s*(#.*))?$";
+use constant regex_sh_varassign        => qr"^([A-Z_a-z][0-9A-Z_a-z]*)=";
 
 # This "constant" is often used in contexts where interpolation comes
 # handy, so it is a variable. Nevertheless it is not modified. Of course
@@ -2275,7 +2276,7 @@
 
                $line->log_debug("[" . scst_statename->[$state] . "] shellword=${shellword}");
 
-               checkline_mk_shellword($line, $shellword, ($state != SCST_CASE && $state != SCST_FOR));
+               checkline_mk_shellword($line, $shellword, ($state != SCST_CASE && $state != SCST_FOR && !($state == SCST_START && $shellword =~ regex_sh_varassign)));
 
                #
                # Actions associated with the current state
@@ -2354,6 +2355,7 @@
                                : ($shellword =~ qr"^(?:then|else|do)$") ? SCST_START
                                : ($shellword eq "case") ? SCST_CASE
                                : ($shellword eq "for") ? SCST_FOR
+                               : ($shellword =~ sh_regex_varassign) ? SCST_START
                                : SCST_CONT)
                        : ($state == SCST_MKDIR) ? SCST_MKDIR
                        : ($state == SCST_INSTALL && $shellword eq "-d") ? SCST_INSTALL_D



Home | Main Index | Thread Index | Old Index