pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Unquoted shell variables may ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/f3bdc432b9b1
branches: trunk
changeset: 505262:f3bdc432b9b1
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Jan 01 22:08:22 2006 +0000
description:
- Unquoted shell variables may appear in for loops.
diffstat:
pkgtools/pkglint/files/pkglint.pl | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (56 lines):
diff -r 36292b318690 -r f3bdc432b9b1 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sun Jan 01 21:58:12 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Sun Jan 01 22:08:22 2006 +0000
@@ -1,5 +1,5 @@
#! @PERL@ -w
-# $NetBSD: pkglint.pl,v 1.445 2006/01/01 21:58:12 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.446 2006/01/01 22:08:22 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -1780,8 +1780,9 @@
use constant SCST_SED => 40;
use constant SCST_SED_E => 41;
use constant SCST_SET => 50;
- use constant SCST_FOR_IF_WHILE => 60;
+ use constant SCST_IF_WHILE => 60;
use constant SCST_CASE => 70;
+ use constant SCST_FOR => 80;
if ($text =~ qr"^\@*-(.*(MKDIR|INSTALL.*-d|INSTALL_.*_DIR).*)") {
my ($mkdir_cmd) = ($1);
@@ -1798,7 +1799,7 @@
$line->log_debug("shellword=$shellword");
- checkline_mk_shellword($line, $shellword, ($state != SCST_CASE));
+ checkline_mk_shellword($line, $shellword, ($state != SCST_CASE && $state != SCST_FOR));
#
# Actions associated with the current state
@@ -1833,7 +1834,7 @@
"temporary files to save the output of the command.");
}
- if ($opt_warn_extra && $shellword eq ";" && $state != SCST_FOR_IF_WHILE && !$set_e_mode) {
+ if ($opt_warn_extra && $shellword eq ";" && $state != SCST_IF_WHILE && $state != SCST_FOR && !$set_e_mode) {
$line->log_warning("A semicolon should only be used to separate commands after switching to \"set -e\" mode.");
$line->explain(
"Older versions of the NetBSD make(1) had run the shell commands using",
@@ -1865,12 +1866,14 @@
$state = SCST_SED;
} elsif ($shellword eq "set") {
$state = SCST_SET;
- } elsif ($shellword =~ qr"^(?:for|if|elif|while)$") {
- $state = SCST_FOR_IF_WHILE;
+ } elsif ($shellword =~ qr"^(?:if|elif|while)$") {
+ $state = SCST_IF_WHILE;
} elsif ($shellword =~ qr"^(?:then|else|do)$") {
$state = SCST_START;
} elsif ($shellword eq "case") {
$state = SCST_CASE;
+ } elsif ($shellword eq "for") {
+ $state = SCST_FOR;
} else {
$state = SCST_CONT;
}
Home |
Main Index |
Thread Index |
Old Index