diff options
author | rillig <rillig> | 2006-02-27 00:01:04 +0000 |
---|---|---|
committer | rillig <rillig> | 2006-02-27 00:01:04 +0000 |
commit | 72e57c3904ece06d6b39318cc135bbcfe0ac504e (patch) | |
tree | 52283ddc85412a2c5448a6a1565c8fbea43f1dca /pkgtools/pkglint | |
parent | df89c1356c041815a052b25b3018c6d6c580f9f5 (diff) | |
download | pkgsrc-72e57c3904ece06d6b39318cc135bbcfe0ac504e.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/pkglint')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 13 |
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 |