pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - New error: The Solaris /bin/s...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ba9b4aba55d4
branches:  trunk
changeset: 507763:ba9b4aba55d4
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Feb 07 22:10:20 2006 +0000

description:
- New error: The Solaris /bin/sh cannot handle "cd" inside conditionals.

diffstat:

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

diffs (55 lines):

diff -r 5ae1455c14ee -r ba9b4aba55d4 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Feb 07 22:07:54 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Feb 07 22:10:20 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.504 2006/02/07 21:44:39 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.505 2006/02/07 22:10:20 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -2463,6 +2463,7 @@
        use constant SCST_FOR_IN        => 17;
        use constant SCST_FOR_CONT      => 18;
        use constant SCST_SET_CONT      => 19;
+       use constant SCST_COND          => 20;
 
        use constant scst_statename => [
                "SCST_START", "SCST_CONT", "SCST_INSTALL", "SCST_INSTALL_D",
@@ -2470,7 +2471,7 @@
                "SCST_SED_E", "SCST_SET", "SCST_COND_CONT", "SCST_CASE",
                "SCST_CASE_IN", "SCST_CASE_LABEL", "SCST_CASE_LABEL_CONT",
                "SCST_CASE_PAREN", "SCST_FOR", "SCST_FOR_IN",
-               "SCST_FOR_CONT", "SCST_SET_CONT",
+               "SCST_FOR_CONT", "SCST_SET_CONT", "SCST_COND",
        ];
 
        if ($text =~ qr"^\@*-(.*(MKDIR|INSTALL.*-d|INSTALL_.*_DIR).*)") {
@@ -2510,6 +2511,10 @@
                        $line->log_warning("Possible direct use of tool \"${shellword}\". Please use \$\{$vartools->{$shellword}\} instead${addition}.");
                }
 
+               if ($state == SCST_COND && $shellword eq "cd") {
+                       $line->log_error("The Solaris /bin/sh cannot handle \"cd\" inside conditionals.");
+               }
+
                if (($state != SCST_PAX_S && $state != SCST_SED_E && $state != SCST_CASE_LABEL) && $shellword =~ qr"^/" && $shellword ne "/dev/null") {
                        $line->log_warning("Found absolute pathname: ${shellword}");
                        $line->explain(
@@ -2574,7 +2579,7 @@
                                : ($shellword eq "\${PAX}") ? SCST_PAX
                                : ($shellword eq "\${SED}") ? SCST_SED
                                : ($shellword eq "set") ? SCST_SET
-                               : ($shellword =~ qr"^(?:if|elif|while)$") ? SCST_COND_CONT
+                               : ($shellword =~ qr"^(?:if|elif|while)$") ? SCST_COND
                                : ($shellword =~ qr"^(?:then|else|do)$") ? SCST_START
                                : ($shellword eq "case") ? SCST_CASE
                                : ($shellword eq "for") ? SCST_FOR
@@ -2604,6 +2609,7 @@
                        : ($state == SCST_CASE_LABEL_CONT && $shellword eq "|") ? SCST_CASE_LABEL
                        : ($state == SCST_CASE_LABEL_CONT && $shellword eq ")") ? SCST_START
                        : ($state == SCST_CONT) ? SCST_CONT
+                       : ($state == SCST_COND) ? SCST_COND_CONT
                        : ($state == SCST_COND_CONT) ? SCST_COND_CONT
                        : ($state == SCST_FOR) ? SCST_FOR_IN
                        : ($state == SCST_FOR_IN && $shellword eq "in") ? SCST_FOR_CONT



Home | Main Index | Thread Index | Old Index