diff options
author | rillig <rillig> | 2008-11-18 19:18:51 +0000 |
---|---|---|
committer | rillig <rillig> | 2008-11-18 19:18:51 +0000 |
commit | e8b397261089294b81b1c639467aed8b0e3eba43 (patch) | |
tree | 1717733edc78d7920410763b34462e9c55e45e54 /pkgtools/pkglint | |
parent | 883d5d78e607b868dcb472e5088d558f6a5aa4e2 (diff) | |
download | pkgsrc-e8b397261089294b81b1c639467aed8b0e3eba43.tar.gz |
Emit a note instead of a warning when the :Q operator is used in places
where it isn't necessary.
The :Q operator is necessary for URLs, since they may contain ampersands.
Diffstat (limited to 'pkgtools/pkglint')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 704d7dbc1db..918d6795013 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.785 2008/11/18 18:59:36 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.786 2008/11/18 19:18:51 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -2994,7 +2994,7 @@ sub variable_needs_quoting($$$) { Option Pathname PkgName PkgOptionsVar PkgRevision RelativePkgDir RelativePkgPath - URL UserGroupName + UserGroupName Varname Version WrkdirSubdirectory )); @@ -3007,7 +3007,7 @@ sub variable_needs_quoting($$$) { # enumerations, are expected to not require the :Q operator. if (ref($type->basic_type) eq "HASH" || exists(safe_types->{$type->basic_type})) { if ($type->kind_of_list == LK_NONE) { - return false; + return doesnt_matter; } elsif ($type->kind_of_list == LK_EXTERNAL && $context->extent != VUC_EXTENT_WORD_PART) { return false; @@ -3936,9 +3936,8 @@ sub checkline_mk_varuse($$$$) { $line->explain_warning("See the pkgsrc guide, section \"quoting guideline\", for details."); } - if ($needs_quoting == false && $mod =~ m":Q$") { - $line->log_warning("The :Q operator should not be used for \${${varname}} here."); - $line->explain_warning( + if ($mod =~ m":Q$") { + my @expl = ( "Many variables in pkgsrc do not need the :Q operator, since they", "are not expected to contain white-space or other evil characters.", "", @@ -3953,6 +3952,13 @@ sub checkline_mk_varuse($$$$) { "\tdemo:", "\t\techo \${WORD1}\${WORD2} # still 1 word"); + if ($needs_quoting == false) { + $line->log_warning("The :Q operator should not be used for \${${varname}} here."); + $line->explain_warning(@expl); + } elsif ($needs_quoting == doesnt_matter) { + $line->log_note("The :Q operator isn't necessary for \${${varname}} here."); + $line->explain_note(@expl); + } } } |