From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Oct 6 08:50:26 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBADC16A403 for ; Fri, 6 Oct 2006 08:50:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8E3E43D5C for ; Fri, 6 Oct 2006 08:50:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k968oNAx084937 for ; Fri, 6 Oct 2006 08:50:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k968oNia084936; Fri, 6 Oct 2006 08:50:23 GMT (envelope-from gnats) Resent-Date: Fri, 6 Oct 2006 08:50:23 GMT Resent-Message-Id: <200610060850.k968oNia084936@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, vd@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8460416A412; Fri, 6 Oct 2006 08:43:15 +0000 (UTC) (envelope-from vd@datamax.bg) Received: from jengal.datamax.bg (jengal.datamax.bg [82.103.104.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0777043D45; Fri, 6 Oct 2006 08:43:15 +0000 (GMT) (envelope-from vd@datamax.bg) Received: from qlovarnika.bg.datamax (qlovarnika.bg.datamax [192.168.10.2]) by jengal.datamax.bg (Postfix) with SMTP id 2469FB844; Fri, 6 Oct 2006 11:43:14 +0300 (EEST) Received: (nullmailer pid 19483 invoked by uid 1002); Fri, 06 Oct 2006 08:43:14 -0000 Message-Id: <20061006084314.GA19345@qlovarnika.bg.datamax> Date: Fri, 6 Oct 2006 11:43:14 +0300 From: Vasil Dimov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: marcus@FreeBSD.org Subject: ports/104042: [patch] devel/portlint: check format of EXPIRATION_DATE X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vd@FreeBSD.org List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Oct 2006 08:50:26 -0000 >Number: 104042 >Category: ports >Synopsis: [patch] devel/portlint: check format of EXPIRATION_DATE >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: Fri Oct 06 08:50:22 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Vasil Dimov >Release: FreeBSD 6.2-PRERELEASE amd64 >Organization: N/A >Environment: >Description: According to http://www.FreeBSD.org/doc/en/books/porters-handbook/dads-deprecated.html EXPIRATION_DATE format should be YYYY-MM-DD. Add check for this to portlint. >How-To-Repeat: http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/cscout-devel/Makefile.diff?r1=1.4&r2=1.5 http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw/Makefile.diff?r1=1.6&r2=1.7 http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-bin-msvcrt/Makefile.diff?r1=1.8&r2=1.9 http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-binutils/Makefile.diff?r1=1.18&r2=1.19 http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-gcc/Makefile.diff?r1=1.24&r2=1.25 http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/mingw-opengl-headers/Makefile.diff?r1=1.7&r2=1.8 >Fix: Here are two patches addressing the same issue, the first one was crafted by dds@ and the second one (a little changed version of the first one) by vd@ --- portlint.pl.diff begins here --- Index: portlint.pl =================================================================== RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v retrieving revision 1.91 diff -u -r1.91 portlint.pl --- portlint.pl 6 Aug 2006 22:36:45 -0000 1.91 +++ portlint.pl 3 Oct 2006 13:37:43 -0000 @@ -1338,6 +1338,20 @@ } # + # whole file: EXPIRATION_DATE + # + print "OK: checking for EXPIRATION_DATE.\n" if ($verbose); + my $date; + if (($date) = ($whole =~ m/\nEXPIRATION_DATE\??=[ \t]*([^\n]*)\n/)) { + my $lineno = &linenumber($`); + if ($date !~ m/(\d{4})-(\d{2})-(\d{2})/) { + &perror("FATAL", $file, $lineno, "EXPIRATION_DATE is not in YYYY-MM-DD format."); + } elsif ($1 < 1970 || $2 < 1 || $2 > 12 || $3 < 1 || $3 > 31) { + &perror("FATAL", $file, $lineno, "EXPIRATION_DATE has an incorrect year, month, or day value."); + } + } + + # # whole file: IS_INTERACTIVE/NOPORTDOCS # print "OK: checking IS_INTERACTIVE.\n" if ($verbose); --- portlint.pl.diff ends here --- --- portlint.pl_strftime.diff begins here --- Index: portlint.pl =================================================================== RCS file: /home/pcvs/ports/devel/portlint/src/portlint.pl,v retrieving revision 1.91 diff -u -r1.91 portlint.pl --- portlint.pl 6 Aug 2006 22:36:45 -0000 1.91 +++ portlint.pl 6 Oct 2006 08:17:05 -0000 @@ -24,6 +24,7 @@ use Getopt::Std; use File::Find; use IPC::Open2; +use POSIX qw(strftime); use strict; sub perror($$$$); @@ -1338,6 +1339,21 @@ } # + # whole file: EXPIRATION_DATE + # + print "OK: checking for EXPIRATION_DATE.\n" if ($verbose); + my $date; + if (($date) = ($whole =~ m/\nEXPIRATION_DATE\??=[ \t]*([^\n]*)\n/)) { + my $lineno = &linenumber($`); + if ($date ne strftime("%Y-%m-%d", 0, 0, 0, + substr($date, 8, 2), + substr($date, 5, 2) - 1, + substr($date, 0, 4) - 1900)) { + &perror("FATAL", $file, $lineno, "EXPIRATION_DATE ($date) is not in YYYY-MM-DD format."); + } + } + + # # whole file: IS_INTERACTIVE/NOPORTDOCS # print "OK: checking IS_INTERACTIVE.\n" if ($verbose); --- portlint.pl_strftime.diff ends here --- -- Vasil Dimov gro.DSBeerF@dv % The man who sets out to carry a cat by its tail learns something that will always be useful and which never will grow dim or doubtful. -- Mark Twain >Release-Note: >Audit-Trail: >Unformatted: