Date: Sat, 15 Oct 2005 16:29:28 -0700 (PDT) From: Bill Fenner <fenner@research.att.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/87498: Additional quoting checks for portlint Message-ID: <200510152329.j9FNTSK0038983@fenestro.dyndns.org> Resent-Message-ID: <200510152330.j9FNUCLS004096@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 87498 >Category: ports >Synopsis: Additional quoting checks for portlint >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Oct 15 23:30:11 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Bill Fenner >Release: FreeBSD 4.9-RELEASE i386 >Organization: AT&T Labs - Research >Environment: System: FreeBSD fenestro.dyndns.org 4.9-RELEASE FreeBSD 4.9-RELEASE #8: Sun Jun 27 11:22:48 PDT 2004 root@fenestro.dyndns.org:/usr/obj/usr/src/sys/FENESTRO i386 (yes, I know, it's pathetic, but irrelevant) >Description: We've been having more and more problems caused by quoting, particularly because of DEPRECATED's obscure requirements. ports/87396 makes it so that bsd.port.mk won't have any more quoting problems, but I understand that bsd.port.mk patches are never "no-brainers" to commit, so until then, having a portlint that knows the rules will help. >How-To-Repeat: Use BROKEN= "Doesn't work" and DEPRECATED=${BROKEN} and type make TRYBROKEN=YES check-sanity or FORBIDDEN= http://www.site.com/vulnerable;strangeurltoo >Fix: This patch requires quotes around all of BROKEN, FORBIDDEN, MANUAL_PACKAGE_BUILD, NO_CDROM, NO_PACKAGE, RESTRICTED. It also enforces the obscure rules about DEPRECATED: it needs either no quotes or two sets, so if it's set to ${BROKEN} it needs to be set to "${BROKEN}", (since BROKEN has one set). cvs diff: Diffing . cvs diff: Diffing src Index: src/portlint.pl =================================================================== RCS file: /home/ncvs/ports/devel/portlint/src/portlint.pl,v retrieving revision 1.76 diff -u -r1.76 portlint.pl --- src/portlint.pl 9 Oct 2005 18:52:58 -0000 1.76 +++ src/portlint.pl 14 Oct 2005 18:55:52 -0000 @@ -1188,13 +1188,32 @@ } # - # whole file: BROKEN + # whole file: BROKEN et al. # - print "OK: checking BROKEN.\n" if ($verbose); - if ($whole =~ /\nBROKEN[+?]?=[ \t][^"]+\w+/) { + my($var); + foreach $var qw(BROKEN FORBIDDEN MANUAL_PACKAGE_BUILD NO_CDROM NO_PACKAGE RESTRICTED) { + print "OK: checking ${var}.\n" if ($verbose); + if ($whole =~ /\n${var}[+?]?=[ \t]?[^"]+\w+/) { + my $lineno = &linenumber($`); + &perror("WARN: $file [$lineno]: ${var} messages should be ". + "quoted."); + } + } + + # + # whole file: DEPRECATED + # + print "OK: checking DEPRECATED.\n" if ($verbose); + if ($whole =~ /\nDEPRECATED[+?]?=[ \t]*"/ && + $whole !~ /\nDEPRECATED[+?]?=[ \t]*"\$\{BROKEN\}"/) { + my $lineno = &linenumber($`); + &perror("WARN: $file [$lineno]: DEPRECATED messages should not ". + "be quoted unless they are exactly \"\${BROKEN}\"."); + } + if ($whole =~ /\nDEPRECATED[+?]?=[^"]*\$\{BROKEN\}/) { my $lineno = &linenumber($`); - &perror("WARN: $file [$lineno]: BROKEN messages should be ". - "quoted."); + &perror("WARN: $file [$lineno]: \"\${BROKEN}\" must be quoted ". + "when it is the source of DEPRECATED."); } # >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510152329.j9FNTSK0038983>