Bug 104042

Summary: [patch] devel/portlint: check format of EXPIRATION_DATE
Product: Ports & Packages Reporter: Vasil Dimov <vd>
Component: Individual Port(s)Assignee: Joe Marcus Clarke <marcus>
Status: Closed FIXED    
Severity: Affects Only Me CC: marcus
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Vasil Dimov freebsd_committer freebsd_triage 2006-10-06 09:50:22 UTC
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.

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@



-- 
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--gut67CMrbxjWEyryRZlxIt9gGBzlhF9qNIjd7Z4f7EI6CfKi
Content-Type: text/plain; name="portlint.pl.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="portlint.pl.diff"

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);
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
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-10-06 09:50:36 UTC
Responsible Changed
From-To: freebsd-ports-bugs->marcus

Over to maintainer
Comment 2 dfilter service freebsd_committer freebsd_triage 2006-11-25 20:02:59 UTC
marcus      2006-11-25 20:02:50 UTC

  FreeBSD ports repository

  Modified files:
    devel/portlint       Makefile 
    devel/portlint/src   portlint.pl 
  Log:
  Update to 2.9.2.
  
  * Replace a dead autotools link with a FreeBSD-based link instead [1]
  * Replace USE_*_VER with USE_AUTOTOOLS instead [2]
  * Check for a valid EXPIRATION_DATE [3]
  
  PR:             104042 [3]
  Requested by:   piotr.smyrak@heron.pl [1]
  Reported by:    ahze [2]
  Submitted by:   vd [3]
  
  Revision  Changes    Path
  1.113     +1 -2      ports/devel/portlint/Makefile
  1.92      +22 -4     ports/devel/portlint/src/portlint.pl
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Joe Marcus Clarke freebsd_committer freebsd_triage 2006-11-25 20:03:15 UTC
State Changed
From-To: open->closed

I went with the strftime implementation.  While it adds a new module 
dependency, it can catch things like November 31, 2006.  Thanks!