From eikemeier@fillmore-labs.com  Wed Sep 17 10:26:32 2003
Return-Path: <eikemeier@fillmore-labs.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 9D87A16A4B3; Wed, 17 Sep 2003 10:26:32 -0700 (PDT)
Received: from mx2.fillmore-labs.com (lima.fillmore-labs.com [62.138.193.83])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id A11DF43FE5; Wed, 17 Sep 2003 10:26:31 -0700 (PDT)
	(envelope-from eikemeier@fillmore-labs.com)
Received: from atlantis.wireless.fillmore-labs.com ([192.168.161.242] helo=fillmore-labs.com)
	by mx2.fillmore-labs.com with asmtp (TLSv1:AES256-SHA:256)
	(Exim 4.22)
	id 19zg4V-0009HC-1N; Wed, 17 Sep 2003 19:26:31 +0200
Message-Id: <3F689945.4060804@fillmore-labs.com>
Date: Wed, 17 Sep 2003 19:26:29 +0200
From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc: portmgr@freebsd.org
Subject: [PATCH] bsd.port.mk: Don't accept PORTVERSIONS that pkg_version can't
 handle

>Number:         56960
>Category:       ports
>Synopsis:       [PATCH] bsd.port.mk: Don't accept PORTVERSIONS that pkg_version can't handle
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 17 10:30:17 PDT 2003
>Closed-Date:    Fri Nov 07 00:58:10 PST 2003
>Last-Modified:  Sun Mar 17 02:09:24 UTC 2013
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

pkg_version (and portupgrade) have to scan PKGNAME for version number.
They look for the last '-', so if PORTVERSION contains a hyphen they
miss the most significant part of the version number.

For a list of ports with a hyphen in their version see PR 56958.

>How-To-Repeat:
>Fix:

The following patch marks ports with non-conforming version numbers as BROKEN and
builds the with the special characters replaced by dots.

--- bsd.port.mk.patch begins here ---
--- bsd.port.mk.orig	Wed Sep  3 21:50:24 2003
+++ bsd.port.mk	Wed Sep 17 19:05:21 2003
@@ -935,6 +935,10 @@
 	@${FALSE}
 .endif
 
+.if ${PORTVERSION:M*[-_,]*}x != x
+BROKEN=		"PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','"
+.endif
+
 PORTREVISION?=	0
 .if ${PORTREVISION} != 0
 _SUF1=	_${PORTREVISION}
@@ -945,7 +949,7 @@
 _SUF2=	,${PORTEPOCH}
 .endif
 
-PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}${_SUF1}${_SUF2}
+PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION:C/[-_,]/./g}${_SUF1}${_SUF2}
 DISTNAME?=	${PORTNAME}-${PORTVERSION}
 
 # These need to be absolute since we don't know how deep in the ports
--- bsd.port.mk.patch ends here ---

Of course, the Makefile could catch more cases with:
.if ${PORTVERSION:C/[^0-9a-z.]/_/:M*_*}x != x
BROKEN=		"PORTVERSION ${PORTVERSION} may only consist of lowercase letters, numbers and dots"
.endif

and

PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION:L:C/[^0-9a-z.]/./g}${_SUF1}${_SUF2}

or at least do

PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION:C/[-_,+]/./g}${_SUF1}${_SUF2}

to catch cases like 1.0+2003.11.17 < 1.0.1+2003.11.17.

The decision is up to portmgr@

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr  
Responsible-Changed-By: krion 
Responsible-Changed-When: Wed Sep 17 10:35:23 PDT 2003 
Responsible-Changed-Why:  
portmgr territory 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56960 
State-Changed-From-To: open->analyzed 
State-Changed-By: marcus 
State-Changed-When: Sat Nov 1 13:46:29 PST 2003 
State-Changed-Why:  
This is currently being tested on bento. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56960 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21885 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=51588 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55325 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57778 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=55674 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Fixed with the comment made in the follow-up.  Thanks for reporting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56096 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56355 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56533 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57272 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed with the additional check of INSTALL_AS_USER.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57378 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57403 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57438 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57488 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57928 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58232 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=58317 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Final version committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32604 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57529 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56582 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48377 
State-Changed-From-To: analyzed->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Nov 7 00:52:50 PST 2003 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56960 
>Unformatted:
