From mike@inbox.lv  Fri Oct 29 19:06:52 2004
Return-Path: <mike@inbox.lv>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1DE0E16A4D0
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Oct 2004 19:06:52 +0000 (GMT)
Received: from out008.verizon.net (out008pub.verizon.net [206.46.170.108])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AB36743D53
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 29 Oct 2004 19:06:51 +0000 (GMT)
	(envelope-from mike@inbox.lv)
Received: from ringworm.mechee.com ([4.26.226.89]) by out008.verizon.net
          (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP
          id <20041029190650.FCPZ17228.out008.verizon.net@ringworm.mechee.com>
          for <FreeBSD-gnats-submit@freebsd.org>;
          Fri, 29 Oct 2004 14:06:50 -0500
Received: by ringworm.mechee.com (Postfix, from userid 1001)
	id 86D152CE7AE; Fri, 29 Oct 2004 12:05:34 -0700 (PDT)
Message-Id: <20041029190534.86D152CE7AE@ringworm.mechee.com>
Date: Fri, 29 Oct 2004 12:05:34 -0700 (PDT)
From: Michael C.Shultz <ringworm@inbox.lv>
Reply-To: Michael C.Shultz <ringworm@inbox.lv>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [MAINTAINER] sysutils/portmanager minor fix
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73292
>Category:       ports
>Synopsis:       [MAINTAINER] sysutils/portmanager minor fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 29 19:10:25 GMT 2004
>Closed-Date:    Mon Nov 01 21:51:48 GMT 2004
>Last-Modified:  Mon Nov 01 21:51:48 GMT 2004
>Originator:     Michael C. Shultz
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD ringworm.mechee.com 5.3-STABLE FreeBSD 5.3-STABLE #0: Sun Oct 24 05:04:58 PDT 2004 mike@ringworm.mechee.com:/usr/obj/usr/src/sys/RINGWORM i386


>Description:

	portmanager seg faults when an installed port's +CONTENTS file has no "@comment ORIGIN:" in it.

>How-To-Repeat:

	install bsdpan-GDTextUtil-0.86 then run portmanager
>Fix:

 patch-ac fixes this problem.

 ***Note added file files/patch-ac***

--- portmanager.shar begins here ---
diff -ruN /usr/ports/sysutils/portmanager/Makefile portmanager/Makefile
--- /usr/ports/sysutils/portmanager/Makefile	Tue Oct 12 09:07:04 2004
+++ portmanager/Makefile	Fri Oct 29 11:49:34 2004
@@ -7,7 +7,7 @@
 
 PORTNAME=		portmanager
 PORTVERSION=		0.2.0
-PORTREVISION=		2
+PORTREVISION=		3
 CATEGORIES=		sysutils
 MASTER_SITES=		${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=	portmanager
diff -ruN /usr/ports/sysutils/portmanager/files/patch-ac portmanager/files/patch-ac
--- /usr/ports/sysutils/portmanager/files/patch-ac	Wed Dec 31 16:00:00 1969
+++ portmanager/files/patch-ac	Thu Oct 28 15:43:02 2004
@@ -0,0 +1,74 @@
+diff -ruN ./libPMGR/src/PMGRrDbCreate.c ../../portmanager-0.2.0/libPMGR/src/PMGRrDbCreate.c
+--- ./libPMGR/src/PMGRrDbCreate.c	Thu Aug 12 02:19:05 2004
++++ ../../portmanager-0.2.0/libPMGR/src/PMGRrDbCreate.c	Thu Oct 28 15:28:20 2004
+@@ -55,6 +55,7 @@
+ 	char*			portDependencyDir	= NULL;
+ 	char*			portDir 		= NULL;
+ 	char*			portName		= NULL;
++	int			address			= 0;
+ 	int			errorCode		= 0;
+ 	int			idx			= 0;
+ 	int			portDependencyDirLen	= 0;
+@@ -140,10 +141,46 @@
+ 		}
+ 		fread( portBuffer, 1, size, portStream );
+ 		portBuffer[size+1]	= 0;
+-		portName		= strstr( portBuffer, "@name " ) + strlen( "@name " );
+-		portNameLen		= strstr( portName, "\n" ) - portName;
+-		portDir			= strstr( portBuffer, "@comment ORIGIN:" ) + strlen( "@comment ORIGIN:" );
+-		portDirLen		= strstr( portDir, "\n" ) - portDir;
++
++		/* sets portName to start address of portname */
++		/* ver 0.2.0_3 added error checking for @name not found int +CONTENTS file */
++		if( (address = (int)strnstr(portBuffer, "@name ", size)) == 0 )
++		{
++			fprintf( stderr, "%s %s error: \"@name\" not found in %s\n", id, ver, pkg.portDirName );
++			fprintf( stderr, "\t\t%s installation is corrupt!\n", pkg.entry->d_name );
++			fprintf( stderr, "\t\trecomend running \"pkg_delete -f %s\" then manually reinstalling this port\n", pkg.entry->d_name );
++			return(1);
++		}
++		portName 		= (char*)(address + strlen("@name "));
++
++		if( (address = (int)strnstr(portName, "\n", 256)) == 0 )
++		{
++			fprintf( stderr, "%s %s portName error: \"end of line\" not found in %s\n", id, ver, pkg.portDirName );
++			fprintf( stderr, "\t\t%s installation is corrupt!\n", pkg.entry->d_name );
++			fprintf( stderr, "\t\trecomend running \"pkg_delete -f %s\" then manually reinstalling this port\n", pkg.entry->d_name );
++			return(1);
++		}
++		portNameLen		= address - (int)portName;
++
++		if( (address = (int)strnstr(portBuffer, "@comment ORIGIN:", size)) == 0 )
++		{
++			fprintf( stderr, "%s %s error: \"@comment ORIGIN:\" not found in %s\n", id, ver, pkg.portDirName );
++			fprintf( stderr, "\t\t%s installation is corrupt!\n", pkg.entry->d_name );
++			fprintf( stderr, "\t\trecomend running \"pkg_delete -f %s\" then manually reinstalling this port\n", pkg.entry->d_name );
++			return(1);
++		}
++		portDir			= (char*)(address + strlen("@comment ORIGIN:"));
++
++
++		if( (address = (int)strnstr(portDir, "\n", 256)) == 0 )
++		{
++			fprintf( stderr, "%s %s portDir error: \"end of line\" not found in %s\n", id, ver, pkg.portDirName );
++			fprintf( stderr, "\t\t%s installation is corrupt!\n", pkg.entry->d_name );
++			fprintf( stderr, "\t\trecomend running \"pkg_delete -f %s\" then manually reinstalling this port\n", pkg.entry->d_name );
++			return(1);
++		}
++		portDirLen		= address - (int)portDir;
++
+ 		portName[portNameLen] 	= 0;
+ 		portDir[portDirLen] 	= 0;
+ 		fprintf( portIStream, "%s%c%s%c\n", portName, NULL, portDir, NULL );
+diff -ruN ./libPMGR/src/libPMGR.h ../../portmanager-0.2.0/libPMGR/src/libPMGR.h
+--- ./libPMGR/src/libPMGR.h	Thu Oct 28 15:33:54 2004
++++ ../../portmanager-0.2.0/libPMGR/src/libPMGR.h	Thu Oct 28 15:31:41 2004
+@@ -33,7 +33,7 @@
+ #include	<pmupgrade.h>
+ 
+ #ifndef VER	
+-static	char	ver[]	= "0.2.0_2";
++static	char	ver[]	= "0.2.0_3";
+ #define VER	1
+ #endif
+ 
--- portmanager.shar ends here ---


>Release-Note:
>Audit-Trail:

From: "Michael C. Shultz" <ringworm@inbox.lv>
To: freebsd-gnats-submit@freebsd.org, ringworm@inbox.lv
Cc:  
Subject: Re: ports/73292: [MAINTAINER] sysutils/portmanager minor fix
Date: Sat, 30 Oct 2004 20:49:27 -0700

 Wups, the attached file is a diff, not a shar, sorry.
 
 -Mike
State-Changed-From-To: open->closed 
State-Changed-By: sem 
State-Changed-When: Mon Nov 1 21:51:39 GMT 2004 
State-Changed-Why:  
Committed, thanks! 

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