pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - The shell variables $!, $# an...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ef512c0c262c
branches:  trunk
changeset: 506128:ef512c0c262c
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Jan 12 13:19:57 2006 +0000

description:
- The shell variables $!, $# and $? are recognized as such. All other
  occurences of a $ in double quoted strings result in a warning.

diffstat:

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

diffs (33 lines):

diff -r 41b79f7beefa -r ef512c0c262c pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Jan 12 13:08:21 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Jan 12 13:19:57 2006 +0000
@@ -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 @@
                        } 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}\".");



Home | Main Index | Thread Index | Old Index