Fri Jul 25 14:15:44 2008 UTC ()
Update to 4.87:
- Add explanation for "Unquoted shell variable" warning.

Patch by rillig.


(dillo)
diff -r1.374 -r1.375 pkgsrc/pkgtools/pkglint/Makefile
diff -r1.769 -r1.770 pkgsrc/pkgtools/pkglint/files/pkglint.pl

cvs diff -r1.374 -r1.375 pkgsrc/pkgtools/pkglint/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/Makefile 2008/05/21 20:16:19 1.374
+++ pkgsrc/pkgtools/pkglint/Makefile 2008/07/25 14:15:44 1.375
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.374 2008/05/21 20:16:19 abs Exp $ 1# $NetBSD: Makefile,v 1.375 2008/07/25 14:15:44 dillo Exp $
2# 2#
3 3
4# Please don't increase the version number if you are not rillig. 4# Please don't increase the version number if you are not rillig.
5DISTNAME= pkglint-4.86 5DISTNAME= pkglint-4.87
6CATEGORIES= pkgtools 6CATEGORIES= pkgtools
7MASTER_SITES= # none 7MASTER_SITES= # none
8DISTFILES= # none 8DISTFILES= # none
9 9
10MAINTAINER= rillig@NetBSD.org 10MAINTAINER= rillig@NetBSD.org
11HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/ 11HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/
12COMMENT= Verifier for NetBSD packages 12COMMENT= Verifier for NetBSD packages
13 13
14DEPENDS+= p5-Digest-SHA1-[0-9]*:../../security/p5-Digest-SHA1 14DEPENDS+= p5-Digest-SHA1-[0-9]*:../../security/p5-Digest-SHA1
15DEPENDS+= p5-enum>=1.016:../../devel/p5-enum 15DEPENDS+= p5-enum>=1.016:../../devel/p5-enum
16DEPENDS+= p5-pkgsrc-Dewey>=1.0:../../pkgtools/p5-pkgsrc-Dewey 16DEPENDS+= p5-pkgsrc-Dewey>=1.0:../../pkgtools/p5-pkgsrc-Dewey
17 17
18PKG_INSTALLATION_TYPES= overwrite pkgviews 18PKG_INSTALLATION_TYPES= overwrite pkgviews

cvs diff -r1.769 -r1.770 pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2008/05/21 20:16:19 1.769
+++ pkgsrc/pkgtools/pkglint/files/Attic/pkglint.pl 2008/07/25 14:15:44 1.770
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#! @PERL@ 1#! @PERL@
2# $NetBSD: pkglint.pl,v 1.769 2008/05/21 20:16:19 abs Exp $ 2# $NetBSD: pkglint.pl,v 1.770 2008/07/25 14:15:44 dillo Exp $
3# 3#
4 4
5# pkglint - static analyzer and checker for pkgsrc packages 5# pkglint - static analyzer and checker for pkgsrc packages
6# 6#
7# Written by: 7# Written by:
8# Roland Illig <rillig@NetBSD.org> 8# Roland Illig <rillig@NetBSD.org>
9# 9#
10# Based on work by: 10# Based on work by:
11# Hubert Feyrer <hubertf@NetBSD.org> 11# Hubert Feyrer <hubertf@NetBSD.org>
12# Thorsten Frueauf <frueauf@NetBSD.org> 12# Thorsten Frueauf <frueauf@NetBSD.org>
13# Thomas Klausner <wiz@NetBSD.org> 13# Thomas Klausner <wiz@NetBSD.org>
14# and others. 14# and others.
15# 15#
@@ -4446,26 +4446,39 @@ sub checkline_mk_shellword($$$) { @@ -4446,26 +4446,39 @@ sub checkline_mk_shellword($$$) {
4446 if ($rest =~ s/^[!#\%&\(\)*+,\-.\/0-9:;<=>?\@A-Z\[\]^_a-z{|}~]+//) { 4446 if ($rest =~ s/^[!#\%&\(\)*+,\-.\/0-9:;<=>?\@A-Z\[\]^_a-z{|}~]+//) {
4447 } elsif ($rest =~ s/^\'//) { 4447 } elsif ($rest =~ s/^\'//) {
4448 $state = SWST_SQUOT; 4448 $state = SWST_SQUOT;
4449 } elsif ($rest =~ s/^\"//) { 4449 } elsif ($rest =~ s/^\"//) {
4450 $state = SWST_DQUOT; 4450 $state = SWST_DQUOT;
4451 } elsif ($rest =~ s/^\`//) { 4451 } elsif ($rest =~ s/^\`//) {
4452 $state = SWST_BACKT; 4452 $state = SWST_BACKT;
4453 } elsif ($rest =~ s/^\\(?:[ !"#'\(\)*;?\\^{|}]|\$\$)//) { 4453 } elsif ($rest =~ s/^\\(?:[ !"#'\(\)*;?\\^{|}]|\$\$)//) {
4454 } elsif ($rest =~ s/^\$\$([0-9A-Z_a-z]+|\#)// 4454 } elsif ($rest =~ s/^\$\$([0-9A-Z_a-z]+|\#)//
4455 || $rest =~ s/^\$\$\{([0-9A-Z_a-z]+|\#)\}//) { 4455 || $rest =~ s/^\$\$\{([0-9A-Z_a-z]+|\#)\}//) {
4456 my ($shvarname) = ($1); 4456 my ($shvarname) = ($1);
4457 if ($opt_warn_quoting && $check_quoting) { 4457 if ($opt_warn_quoting && $check_quoting) {
4458 $line->log_warning("Unquoted shell variable \"${shvarname}\"."); 4458 $line->log_warning("Unquoted shell variable \"${shvarname}\".");
 4459 $line->explain_warning(
 4460"When a shell variable contains white-space, it is expanded (split into",
 4461"multiple words) when it is written as \$variable in a shell script.",
 4462"If that is not intended, you should add quotation marks around it,",
 4463"like \"\$variable\". Then, the variable will always expand to a single",
 4464"word, preserving all white-space and other special characters.",
 4465"",
 4466"Example:",
 4467"\tfname=\"Curriculum vitae.doc\"",
 4468"\tcp \$fname /tmp",
 4469"\t# tries to copy the two files \"Curriculum\" and \"Vitae.doc\"",
 4470"\tcp \"\$fname\" /tmp",
 4471"\t# copies one file, as intended");
4459 } 4472 }
4460 4473
4461 } elsif ($rest =~ s/^\$\@//) { 4474 } elsif ($rest =~ s/^\$\@//) {
4462 $line->log_warning("Please use \"\${.TARGET}\" instead of \"\$@\"."); 4475 $line->log_warning("Please use \"\${.TARGET}\" instead of \"\$@\".");
4463 $line->explain_warning( 4476 $line->explain_warning(
4464 "It is more readable and prevents confusion with the shell variable of", 4477 "It is more readable and prevents confusion with the shell variable of",
4465 "the same name."); 4478 "the same name.");
4466 4479
4467 } elsif ($rest =~ s/^\$\$\@//) { 4480 } elsif ($rest =~ s/^\$\$\@//) {
4468 $line->log_warning("The \$@ shell variable should only be used in double quotes."); 4481 $line->log_warning("The \$@ shell variable should only be used in double quotes.");
4469 4482
4470 } elsif ($rest =~ s/^\$\$\?//) { 4483 } elsif ($rest =~ s/^\$\$\?//) {
4471 $line->log_warning("The \$? shell variable is often not available in \"set -e\" mode."); 4484 $line->log_warning("The \$? shell variable is often not available in \"set -e\" mode.");