From nobody@FreeBSD.org  Sat Feb 11 11:41:31 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B595716A420
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Feb 2006 11:41:31 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8310F43D45
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Feb 2006 11:41:31 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k1BBfVeF006473
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 11 Feb 2006 11:41:31 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k1BBfVYQ006472;
	Sat, 11 Feb 2006 11:41:31 GMT
	(envelope-from nobody)
Message-Id: <200602111141.k1BBfVYQ006472@www.freebsd.org>
Date: Sat, 11 Feb 2006 11:41:31 GMT
From: Eric <eric7wang@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: patch for portmanager crash when trying to remove a MOVED port with -y option
X-Send-Pr-Version: www-2.3

>Number:         93178
>Category:       ports
>Synopsis:       patch for sysutils/portmanager crash when trying to remove a MOVED port with -y option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ehaupt
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 11 11:50:03 GMT 2006
>Closed-Date:    Thu Feb 23 03:15:46 CET 2006
>Last-Modified:  Thu Feb 23 03:15:46 CET 2006
>Originator:     Eric
>Release:        RELENG_6
>Organization:
>Environment:
FreeBSD mybsd.mydomain.test 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #10: Fri Feb 10 01:45:19 EST 2006    root@mybsd.mydomain.test:/uu/obj/uu/src/sys/MYKERNEL  i386
        
>Description:
portmanager -v:
rParseCommandLine 0.4.1_4

portmanager will always crash (bus error) when:
-y option is provided, and
an installed port was moved to other category, so portmanager trying to remove it.

BackTrace shows the error happends at line 183 in libMGPM/src/MGPMrGetPortName.c
>How-To-Repeat:
execute: portmanager -u -bu -l -y
and you have one installed port (ex, tomcat)  which was moved to another category.


portmanager will crash during cache building stage.






>Fix:
Patch: 
(This is the first time I submit PR, so not sure if this is correct)
--------PATCH START---------
--- libMGPM/src/MGPMrGetPortName.c      Wed Dec 14 10:27:41 2005
+++ libMGPM/src/MGPMrGetPortName2.c     Fri Feb 10 21:43:34 2006
@@ -180,7 +180,8 @@
                        }
                        else
                        {
-                               fclose( property->STDIN );
+                               if( property->autoMoved == 0 )
+                                       fclose( property->STDIN );
                                MGPMlogAdd( property, "installed ", portName,
                                        " removed from system:  no longer in ports tree:  see /usr/ports/MOVED", " ", " " );                        }
--------PATCH END-----------
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Feb 11 20:31:48 UTC 2006 
Responsible-Changed-Why:  
Make this a ports bug. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93178 
Responsible-Changed-From-To: freebsd-ports-bugs->ehaupt 
Responsible-Changed-By: ehaupt 
Responsible-Changed-When: Thu Feb 23 03:10:24 CET 2006 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93178 
State-Changed-From-To: open->closed 
State-Changed-By: ehaupt 
State-Changed-When: Thu Feb 23 03:15:45 CET 2006 
State-Changed-Why:  
Committed, thanks! 

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