summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig>2006-02-27 00:01:04 +0000
committerrillig <rillig>2006-02-27 00:01:04 +0000
commit9232edf66f1f2bf6b60e7459d75cf484026fc176 (patch)
tree52283ddc85412a2c5448a6a1565c8fbea43f1dca /pkgtools
parenta4843aefb0a30c5f2e6f14a9071d01469540d210 (diff)
downloadpkgsrc-9232edf66f1f2bf6b60e7459d75cf484026fc176.tar.gz
- Added a list of forbidden commands that must not be used in packages.
Currently this list contains ktrace, strace and truss, as these are too platform-specific. Suggested by tron.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 9c8a126c96d..3e924ddf140 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.535 2006/02/26 17:40:44 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.536 2006/02/27 00:01:04 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -2599,6 +2599,12 @@ sub checkline_mk_shelltext($$) {
"SCST_FOR_CONT", "SCST_SET_CONT", "SCST_COND",
];
+ use constant forbidden_commands => array_to_hash(qw(
+ ktrace
+ strace
+ truss
+ ));
+
if ($text =~ qr"^\@*-(.*(MKDIR|INSTALL.*-d|INSTALL_.*_DIR).*)") {
my ($mkdir_cmd) = ($1);
@@ -2636,6 +2642,10 @@ sub checkline_mk_shelltext($$) {
$line->log_warning("Possible direct use of tool \"${shellword}\". Please use \$\{$vartools->{$shellword}\} instead${addition}.");
}
+ if ($state == SCST_START && exists(forbidden_commands->{$shellword})) {
+ $line->log_error("${shellword} is forbidden and must not be used.");
+ }
+
if ($state == SCST_COND && $shellword eq "cd") {
$line->log_error("The Solaris /bin/sh cannot handle \"cd\" inside conditionals.");
}
@@ -2708,6 +2718,7 @@ sub checkline_mk_shelltext($$) {
: ($shellword =~ qr"^(?:then|else|do)$") ? SCST_START
: ($shellword eq "case") ? SCST_CASE
: ($shellword eq "for") ? SCST_FOR
+ : ($shellword eq "(") ? SCST_START
: ($shellword =~ regex_sh_varassign) ? SCST_START
: SCST_CONT)
: ($state == SCST_MKDIR) ? SCST_MKDIR