From owner-freebsd-questions@FreeBSD.ORG Sat Nov 12 18:37:03 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E3B616A420 for ; Sat, 12 Nov 2005 18:37:03 +0000 (GMT) (envelope-from ringworm01@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.207]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5242643D5C for ; Sat, 12 Nov 2005 18:36:50 +0000 (GMT) (envelope-from ringworm01@gmail.com) Received: by xproxy.gmail.com with SMTP id s9so350995wxc for ; Sat, 12 Nov 2005 10:36:49 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:message-id; b=c7RIZYHWLZl0M/14lX2KNDgeg4Gt+iYHThLYwbHyJ1/zNnaanRwZJoodrQP9x1Uzk15kDSMnJemhZRRDRfghE5Vzytt5aBE3u7bhFNATVSX90qYfT73c98DSr2yWWJzQyATc/VfZHjnfGmfkz0/q+PcwfgGXsboJ3irYqda+HHc= Received: by 10.70.60.5 with SMTP id i5mr186556wxa; Sat, 12 Nov 2005 08:45:28 -0800 (PST) Received: from ?192.168.1.10? ( [71.102.14.129]) by mx.gmail.com with ESMTP id h39sm455837wxd.2005.11.12.08.45.24; Sat, 12 Nov 2005 08:45:27 -0800 (PST) From: "Michael C. Shultz" To: cpghost Date: Sat, 12 Nov 2005 08:35:55 -0800 User-Agent: KMail/1.8.3 References: <20051112154221.GA71266@fw.farid-hajji.net> In-Reply-To: <20051112154221.GA71266@fw.farid-hajji.net> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_snhdD5U4FRzn2Kf" Message-Id: <200511120835.56586.ringworm01@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: portmanager coredumps [with backtrace] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2005 18:37:03 -0000 --Boundary-00=_snhdD5U4FRzn2Kf Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Saturday 12 November 2005 07:42, cpghost wrote: > First time using portmanager. Using command line: > # portmanager -u -pi editors/openoffice-1.1 -l -f > It coredumps approx at line 00218 or so: > > MGPMrController 0.3.4_0 info: running in forced update mode > ------------------------------------------------------------------------ > portmanager 0.3.4_0: Collecting installed port data "forced mode" > ------------------------------------------------------------------------ > 00574 setiathome-3.08_3 /astro/setiathome > 00573 compat4x-i386-5.3_2 /misc/compat4x > 00572 localedata-5.4 /misc/localedata > 00571 tiff-3.7.4 /graphics/tiff > 00570 libtool-1.5.20 /devel/libtool15 > 00569 jpeg-6b_3 /graphics/jpeg > [...] > > Here's the backtrace: > > #0 0x2812c216 in strcpy () from /lib/libc.so.6 > #1 0x080fd000 in ?? () > #2 0x2807f82c in rrGetPortName (property=0xbfbfeb50, > portDir=0x80ed000 "/ports/multimedia/avifile/../win32-codecs", > portName=0x80fd000 "qt-3.3.5") at MGPMrCreateAllUpdateStatusDb.c:209 > #3 0x2808047b in rrParse (property=0xbfbfeb50, > availablePortName=0x80ad000 "avifile-0.7.41,2", > availablePortDir=0x809d000 "/multimedia/avifile", > dependType=0xbfbfe790 "RUN_DEPENDS", > buffer=0x80cd000 "/usr/X11R6/bin/moc:/usr/ports/x11-toolkits/qt33", > counterPtr=0xbfbfe84c) at MGPMrCreateAllUpdateStatusDb.c:496 > #4 0x280801e4 in rrDependencyParse (property=0xbfbfeb50, > buffer=0x80cd000 "/usr/X11R6/bin/moc:/usr/ports/x11-toolkits/qt33", > availablePortName=0x80ad000 "avifile-0.7.41,2", > availablePortDir=0x809d000 "/multimedia/avifile", > dependType=0xbfbfe790 "RUN_DEPENDS", counterPtr=0xbfbfe84c) > at MGPMrCreateAllUpdateStatusDb.c:424 > #5 0x2807ff3e in rrFillDependencies (property=0xbfbfeb50, > availablePortName=0x80ad000 "avifile-0.7.41,2", > availablePortDir=0x809d000 "/multimedia/avifile", > counterPtr=0xbfbfe84c) at MGPMrCreateAllUpdateStatusDb.c:351 > #6 0x2807f5d6 in rrFindDepends (property=0xbfbfeb50, > availablePortDir=0x809d000 "/multimedia/avifile", > availablePortName=0x80ad000 "avifile-0.7.41,2", counterPtr=0xbfbfe84c) > at MGPMrCreateAllUpdateStatusDb.c:149 > #7 0x2807f4c9 in MGPMrCreateAllUpdateStatusDb (property=0xbfbfeb50) > at MGPMrCreateAllUpdateStatusDb.c:117 > #8 0x2807e7ce in rPmUpgradeNewMethod (property=0xbfbfeb50) > at MGPMrController.c:727 > #9 0x2807d724 in MGPMrController (property=0xbfbfeb50, > path=0xbfbfead0 "PMUPGRADE") at MGPMrController.c:408 > #10 0x2807be6d in rParseCommandLine (property=0xbfbfeb50, argc=6, > argv=0xbfbfed18) at MGPMrCommandLine.c:302 > #11 0x2807b5d9 in MGPMrCommandLine (argc=6, argv=0xbfbfed18) > at MGPMrCommandLine.c:115 > #12 0x08048533 in main (argc=6, argv=0xbfbfed18) at portmanager.c:38 > > --- > > epia2# portmanager --version > rCreateCommandLineDb 0.3.4_0 info: executing rm -f > /usr/local/share/portmanager/ commandLine.db > > rParseCommandLine 0.3.4_0 > > --- > > 6.0-STABLE FreeBSD 6.0-STABLE #0: Sat Nov 12 07:32:20 CET 2005 > > Regards, > -cpghost. This is a good job of providing information. FreeBSD 6.0 has exposed a few bugs that I didn't find in 5.4, there is allready a pach submitted that may fix this one, if it doesn't I need the same information after it is applied. I've attached the patch in case you don't want to wait for http://www.freebsd.org/cgi/query-pr.cgi?pr=88888 to be commited, just mkdir sysutils/portmanager/files, place the patch in there then rebuild reinstall. -Mike --Boundary-00=_snhdD5U4FRzn2Kf Content-Type: text/x-diff; charset="iso-8859-1"; name="patch-0.3.4_1" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-0.3.4_1" diff -ruN ../0.3.4/externVars.h.in ./externVars.h.in --- ../0.3.4/externVars.h.in Fri Nov 11 06:31:14 2005 +++ ./externVars.h.in Fri Nov 11 19:38:50 2005 @@ -78,13 +78,13 @@ #define PACKAGE_NAME "portmanager" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "portmanager 0.3.4" +#define PACKAGE_STRING "portmanager 0.3.5" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "portmanager" /* Define to the version of this package. */ -#define PACKAGE_VERSION "0.3.4" +#define PACKAGE_VERSION "0.3.5" /* location of ports registry, default is /var/db/pkg */ #define PKGDBDIR "@PKGDBDIR@" diff -ruN ../0.3.4/libMG/src/MGdbAdd.c ./libMG/src/MGdbAdd.c --- ../0.3.4/libMG/src/MGdbAdd.c Mon Nov 7 16:46:00 2005 +++ ./libMG/src/MGdbAdd.c Fri Nov 11 17:23:26 2005 @@ -58,6 +58,14 @@ { break; } + + /* + * prevent null data from being placed into record fields + */ + if( strlen( paramPtr ) < 1 ) + { + assert(0); + } fprintf( dbFileStream, "%s%c", paramPtr, 0 ); /* diff -ruN ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c --- ../0.3.4/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 10 16:12:52 2005 +++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Fri Nov 11 19:30:42 2005 @@ -32,7 +32,6 @@ int rrDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr ); int rrFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr ); int rrFindDepends( structProperty* property, char* availablePortDir, char* availablePortName, int* counterPtr ); -int rrGetPortName( structProperty* property, char* portDir, char* portName ); int rrParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr ); int MGPMrCreateAllUpdateStatusDb( structProperty* property ) @@ -116,7 +115,7 @@ strcpy( availablePortDir, installedPortsDbPortDirPtr ); if( ( errorCode = rrFindDepends( property, availablePortDir, availablePortName, counterPtr ) ) == 100 ) { - MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); + property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); installedPortsDbQTY--; } installedPortsDbIDX++; @@ -137,10 +136,10 @@ int errorCode = 0; int availablePortsDbQTY = 0; - if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) ) + if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) ) { /* - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rrGetPortName", errorCode ); + fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode ); */ return( 100 ); } @@ -174,12 +173,12 @@ return( 0 ); } -int rrGetPortName( structProperty* property, char* portDir, char* portName ) +int MGPMrGetPortName( structProperty* property, char* portDir, char* portName ) { - DIR* dirStream = NULL; + FILE* fileStream = NULL; FILE* makeStream = NULL; char exact[] = "exact"; - char id[] = "rrGetPortName"; + char id[] = "MGPMrGetPortName"; char* availablePortsDbPortNamePtr = NULL; char* charPtr = NULL; char* command = NULL; @@ -195,22 +194,27 @@ if( availablePortsDbPortNamePtr == NULL ) { - /* - * see if this port has anything special in configDb - */ - MGdbGoTop( property->configDb ); - optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact ); + MGdbGoTop( property->installedPortsDb ); + if( MGdbSeek( property->installedPortsDb, + property->fieldInstalledPortsDbPortDir, + portDir, + property->fieldInstalledPortsDbPortName, + exact ) ) + { + strcpy( portName, MGdbGet( property->installedPortsDb, + MGdbGetRecno( property->installedPortsDb ) - 1, + property->fieldInstalledPortsDbPortName ) ); + } + else + { + portName[0] = 0; + } strcpy( command, PORTSDIR ); strcat( command, portDir ); - dirStream = opendir( command ); - if( dirStream == 0 ) /* bad dir */ + strcat( command, "/Makefile" ); + fileStream = fopen( command, "r" ); + if( fileStream == NULL || ( MGrFileSize( command ) < 10 ) ) /* no or empty Makefile */ { - MGdbGoTop( property->installedPortsDb ); - strcpy( portName, MGdbSeek( property->installedPortsDb, - property->fieldInstalledPortsDbPortDir, - portDir, - property->fieldInstalledPortsDbPortName, - exact ) ); fprintf( stdout,"%s\n", SINGLE_LINES ); fprintf( stdout, "%s %s is no longer in the ports collection, see /usr/ports/MOVED\nthis port must be removed for portmanager to continue\nis it OK to remove %s from your system? (yes/no/auto yes to all) [y/n/a] [y]\n", @@ -275,16 +279,30 @@ strcpy( command, "pkg_delete -f " ); strcat( command, portName ); fprintf( stdout,"%s\n", command ); - fprintf( stdout,"%s\n", SINGLE_LINES ); while( fflush( stdout ) ); system( command ); + + strcpy( command, "rm -r " ); + strcat( command, PORTSDIR ); + strcat( command, portDir ); + fprintf( stdout, "executing: %s\n", command ); + while( fflush( stdout ) ); + system( command ); + fprintf( stdout,"%s\n", SINGLE_LINES ); + free( command ); return( 100 ); } else { - closedir( dirStream ); + fclose( fileStream ); } + + /* + * see if this port has anything special in configDb + */ + MGdbGoTop( property->configDb ); + optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact ); strcpy( command, "cd " ); strcat( command, PORTSDIR ); strcat( command, portDir ); @@ -493,7 +511,7 @@ { assert(0); } - rrGetPortName( property, dependencyPortDir, dependencyPortName ); + MGPMrGetPortName( property, dependencyPortDir, dependencyPortName ); /* * add dependency to availableDependenciesDb may contain dupes */ diff -ruN ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c ./libMGPM/src/MGPMrMakeDescribe.c --- ../0.3.4/libMGPM/src/MGPMrMakeDescribe.c Mon Nov 7 16:46:00 2005 +++ ./libMGPM/src/MGPMrMakeDescribe.c Fri Nov 11 19:36:11 2005 @@ -90,11 +90,7 @@ if( MGdbSeek( property->cacheDb, property->fieldCacheDbPortDir, installedPortDir, property->fieldCacheDbPortDir, exact ) ) { cacheIdx = MGdbGetRecno( property->cacheDb ) - 1; - if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) ) - { - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode ); - return( 1 ); - } + property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx ); MGdbDestroy( property->cacheDb ); free( strMakeFile ); free( strMakeFileSize ); @@ -135,11 +131,7 @@ else { /* if here then Makefile time is wrong so delete the cache db record */ - if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) ) - { - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode ); - return( 1 ); - } + property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx ); cacheIdx = cacheQty; break; } @@ -147,11 +139,7 @@ else { /* if here then Makefile size is wrong so delete the record */ - if( ( errorCode = MGdbDelete( property->cacheDb, cacheIdx ) ) ) - { - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode ); - return( 1 ); - } + property->cacheDb = MGdbDelete( property->cacheDb, cacheIdx ); cacheIdx = cacheQty; break; } diff -ruN ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c ./libMGPM/src/MGPMrShowLeavesDelete.c --- ../0.3.4/libMGPM/src/MGPMrShowLeavesDelete.c Thu Nov 10 19:38:55 2005 +++ ./libMGPM/src/MGPMrShowLeavesDelete.c Fri Nov 11 19:18:14 2005 @@ -31,7 +31,7 @@ #include int nuke( char* leafPortDir ); -int rebuildDb( structProperty* property, int* installedPortsDbQTY ); +int rebuildDb( structProperty* property ); int removePort( structProperty* property, char* leafPortName, int installedPortsDbIDX ); int MGPMrShowLeavesDelete( structProperty* property ) @@ -42,8 +42,6 @@ char* leafPortDir = NULL; char* leafPortName = NULL; char* pkgDescFile = NULL; - char* portDirPtr = NULL; - char* portTypePtr = NULL; int bufferSize = 0xffff; int installedPortsDbIDX = 0; int installedPortsDbQTY = 0; @@ -68,13 +66,6 @@ return( 1 ); } - if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL ) - { - fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName ); - perror( "system" ); - return( 1 ); - } - if( ( property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName ) ) == NULL ) { fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->availableDependenciesDbFileName ); @@ -104,145 +95,124 @@ } /* - * check for no run depends + * check for no dependencies */ - MGdbGoTop( property->dependencyPortsDb ); - portDirPtr = MGdbSeek( property->dependencyPortsDb, - property->fieldDependencyDbDependencyPortDir, - leafPortDir, - property->fieldDependencyDbDependencyPortDir, - exact ); - - /* - * check for no build depends - */ - if( !portDirPtr ) + MGdbGoTop( property->availableDependenciesDb ); + if( MGdbSeek( property->availableDependenciesDb, + property->fieldAvailableDependenciesDbDependencyDir, + leafPortDir, + property->fieldAvailableDependenciesDbDependencyDir, + exact ) ) + { + installedPortsDbIDX++; + continue; + } + if( key != KEY_ENTER ) { - MGdbGoTop( property->availableDependenciesDb ); - portTypePtr = MGdbSeek( property->availableDependenciesDb, - property->fieldAvailableDependenciesDbDependencyDir, - leafPortDir, - property->fieldAvailableDependenciesDbDependType, - exact ); - - while( portTypePtr && strcmp( portTypePtr, "BUILD_DEPENDS" ) ) - { - portTypePtr = MGdbSeek( property->availableDependenciesDb, - property->fieldAvailableDependenciesDbDependencyDir, - leafPortDir, - property->fieldAvailableDependenciesDbDependType, - exact ); + system( "clear" ); + fprintf( stdout,"%s\n", SINGLE_LINES ); + fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" ); + fprintf( stdout,"%s\n", SINGLE_LINES ); + fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" ); + fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" ); + if( property->buildDependsAreLeaves ) + { + fprintf( stdout, "however, other ports may rely on these to build.\"\n" ); + } + fprintf( stdout, "%s\n", SINGLE_LINES ); + + fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir ); + while( fflush( stdout ) ); + + strcpy( pkgDescFile, PORTSDIR ); + strcat( pkgDescFile, leafPortDir ); + strcat( pkgDescFile, "/pkg-descr" ); + + if( MGrIfFileExist( pkgDescFile ) ) + { + strcpy( command, "cat " ); + strcat( command, pkgDescFile ); + system( command ); + fprintf( stdout, "\n" ); + } + else + { + strcpy( command, "grep COMMENT " ); + strcat( command, PORTSDIR ); + strcat( command, leafPortDir ); + strcat( command, "/Makefile" ); + system( command ); } + fprintf( stdout,"%s\n", SINGLE_LINES ); + fprintf( stdout, "\n to skip\n removes port\n *Nuke it*, removes distribution files\n\n" ); + fprintf( stdout,"%s\n", SINGLE_LINES ); } - - if( !portTypePtr && !portDirPtr ) + key = getc( stdin ); + switch( key ) { - if( key != KEY_ENTER ) + case KEY_ENTER: + { + continue; + } + case KEY_SPACE: + { + MGdbAdd( property->ignoreDb, leafPortDir, "-slid skipped", NULL ); + fprintf( stdout, " Skipping %s\n\n", leafPortName ); + break; + } + case KEY_n: + { + /* nuke() */ + fprintf( stdout, " Nuking %s\n\n", leafPortName ); + removePort( property, leafPortName, installedPortsDbIDX ); + nuke( leafPortDir ); + rebuildDb( property ); + installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); + installedPortsDbIDX = 1; + break; + } + case KEY_N: + { + /* nuke() */ + fprintf( stdout, " Nuking %s\n\n", leafPortName ); + removePort( property, leafPortName, installedPortsDbIDX ); + nuke( leafPortDir ); + rebuildDb( property ); + installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); + installedPortsDbIDX = 1; + break; + } + case KEY_x: + { + /* delete() */ + fprintf( stdout, " Removing %s\n\n", leafPortName ); + removePort( property, leafPortName, installedPortsDbIDX ); + rebuildDb( property ); + installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); + installedPortsDbIDX = 1; + break; + } + case KEY_X: { - system( "clear" ); - fprintf( stdout,"%s\n", SINGLE_LINES ); - fprintf( stdout, "*** for safety run portmanager -u after using this feature for deletion ***\n" ); - fprintf( stdout,"%s\n", SINGLE_LINES ); - fprintf( stdout, "Ports with no ports depending on them AKA \"leaf ports.\"\n" ); - fprintf( stdout, "These ports may be deinstalled because no other ports rely on them to run;\"\n" ); - if( property->buildDependsAreLeaves ) - { - fprintf( stdout, "however, other ports may rely on these to build.\"\n" ); - } - fprintf( stdout, "%s\n", SINGLE_LINES ); - - fprintf( stdout, "%s dir -=> %s\n\n", leafPortName, leafPortDir ); - while( fflush( stdout ) ); - - strcpy( pkgDescFile, PORTSDIR ); - strcat( pkgDescFile, leafPortDir ); - strcat( pkgDescFile, "/pkg-descr" ); - - if( MGrIfFileExist( pkgDescFile ) ) - { - strcpy( command, "cat " ); - strcat( command, pkgDescFile ); - system( command ); - fprintf( stdout, "\n" ); - } - else - { - strcpy( command, "grep COMMENT " ); - strcat( command, PORTSDIR ); - strcat( command, leafPortDir ); - strcat( command, "/Makefile" ); - system( command ); - } - fprintf( stdout,"%s\n", SINGLE_LINES ); - fprintf( stdout, "\n to skip\n removes port\n *Nuke it*, removes distribution files\n\n" ); - fprintf( stdout,"%s\n", SINGLE_LINES ); + /* delete() */ + fprintf( stdout, " Removing %s\n\n", leafPortName ); + removePort( property, leafPortName, installedPortsDbIDX ); + rebuildDb( property ); + installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); + installedPortsDbIDX = 1; + break; } - key = getc( stdin ); - switch( key ) + default: { - case KEY_ENTER: - { - continue; - } - case KEY_SPACE: - { - MGdbAdd( property->ignoreDb, leafPortDir, "-slid skipped", NULL ); - fprintf( stdout, " Skipping %s\n\n", leafPortName ); - break; - } - case KEY_n: - { - /* nuke() */ - fprintf( stdout, " Nuking %s\n\n", leafPortName ); - removePort( property, leafPortName, installedPortsDbIDX ); - nuke( leafPortDir ); - rebuildDb( property, &installedPortsDbQTY ); - break; - } - case KEY_N: - { - /* nuke() */ - fprintf( stdout, " Nuking %s\n\n", leafPortName ); - removePort( property, leafPortName, installedPortsDbIDX ); - nuke( leafPortDir ); - rebuildDb( property, &installedPortsDbQTY ); - installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); - installedPortsDbIDX = 1; - break; - } - case KEY_x: - { - /* delete() */ - fprintf( stdout, " Removing %s\n\n", leafPortName ); - removePort( property, leafPortName, installedPortsDbIDX ); - rebuildDb( property, &installedPortsDbQTY ); - installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); - installedPortsDbIDX = 1; - break; - } - case KEY_X: - { - /* delete() */ - fprintf( stdout, " Removing %s\n\n", leafPortName ); - removePort( property, leafPortName, installedPortsDbIDX ); - rebuildDb( property, &installedPortsDbQTY ); - installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); - installedPortsDbIDX = 1; - break; - } - default: - { - MGdbAdd( property->ignoreDb, leafPortDir, "-slid skipped", NULL ); - fprintf( stdout, "Skipping %s\n\n", leafPortName ); - break; - } + MGdbAdd( property->ignoreDb, leafPortDir, "-slid skipped", NULL ); + fprintf( stdout, "Skipping %s\n\n", leafPortName ); + break; } - fprintf( stdout, "\n" ); } + fprintf( stdout, "\n" ); installedPortsDbIDX++; } MGdbDestroy( property->availableDependenciesDb ); - MGdbDestroy( property->dependencyPortsDb ); MGdbDestroy( property->ignoreDb ); MGdbDestroy( property->installedPortsDb ); free( command ); @@ -260,18 +230,7 @@ command = (char*)calloc( 0xffff, 1 ); - MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); - - MGdbGoTop( property->dependencyPortsDb ); - while( MGdbSeek( property->dependencyPortsDb, - property->fieldDependencyDbPortName, - leafPortNamePtr, - property->fieldDependencyDbPortName, - exact ) ) - { - MGdbDelete( property->dependencyPortsDb, MGdbGetRecno( property->dependencyPortsDb ) - 1 ); - MGdbGoTop( property->dependencyPortsDb ); - } + property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); MGdbGoTop( property->availableDependenciesDb ); while( MGdbSeek( property->availableDependenciesDb, @@ -280,7 +239,8 @@ property->fieldAvailableDependenciesDbPortName, exact ) ) { - MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 ); + property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb, + MGdbGetRecno( property->availableDependenciesDb ) - 1 ); MGdbGoTop( property->availableDependenciesDb ); } @@ -312,7 +272,7 @@ } /***********************************************************************/ -int rebuildDb( structProperty* property, int* installedPortsDbQTY ) +int rebuildDb( structProperty* property ) { char id[] = "rebuildDb"; @@ -321,7 +281,6 @@ fprintf( stdout,"%s\n", SINGLE_LINES ); while( fflush( stdout ) ); - MGdbDestroy( property->dependencyPortsDb ); MGdbDestroy( property->installedPortsDb ); if( MGPMrCreateInstalledDb( property ) ) { @@ -335,12 +294,5 @@ return( 1 ); } - if( ( property->dependencyPortsDb = MGdbOpen( property->dependencyPortsDbFileName ) ) == NULL ) - { - fprintf( stdout, "%s %s error: failed to open %s\n", id, PACKAGE_VERSION, property->dependencyPortsDbFileName ); - perror( "system" ); - return( 1 ); - } - *installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); return( 0 ); } diff -ruN ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c --- ../0.3.4/libMGPM/src/MGPMrSinglePortCreateStatusDb.c Thu Nov 10 16:13:20 2005 +++ ./libMGPM/src/MGPMrSinglePortCreateStatusDb.c Fri Nov 11 18:28:43 2005 @@ -32,7 +32,7 @@ int rSinglePortUpgrade( structProperty* property, int forced ); int rDependencyParse( structProperty* property, char* buffer, char* availablePortName, char* availablePortDir, char* dependType, int* counterPtr ); int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr ); -int rGetPortName( structProperty* property, char* portDir, char* portName ); +int MGPMrGetPortName( structProperty* property, char* portDir, char* portName ); int rParse( structProperty* property, char* availablePortName, char* availablePortDir, char* dependType, char* buffer, int* counterPtr ); int MGPMrSinglePortCreateStatusDb( structProperty* property, char* portDir ) @@ -100,11 +100,12 @@ property->availableDependenciesDb = MGdbOpen( property->availableDependenciesDbFileName ); property->configDb = MGdbOpen( property->configDbFileName ); + property->installedPortsDb = MGdbOpen( property->installedPortsDbFileName ); } - if( ( errorCode = rGetPortName( property, availablePortDir, availablePortName ) ) ) + if( ( errorCode = MGPMrGetPortName( property, availablePortDir, availablePortName ) ) ) { - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rGetPortName", errorCode ); + fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGPMrGetPortName", errorCode ); return( 1 ); } @@ -148,6 +149,7 @@ } if( property->optionsChanged == 0 ) /* set by MGPMrUpdate for example to indicate a ports's options just changed */ { + MGdbDestroy( property->installedPortsDb ); MGdbDestroy( property->availablePortsDb ); MGdbDestroy( property->availableDependenciesDb ); MGdbDestroy( property->configDb ); @@ -157,76 +159,6 @@ return( 0 ); } -int rGetPortName( structProperty* property, char* portDir, char* portName ) -{ - FILE* makeStream = NULL; - char exact[] = "exact"; - char id[] = "rGetPortName"; - char* availablePortsDbPortNamePtr = NULL; - char* charPtr = NULL; - char* command = NULL; - char* optionsPtr = NULL; - int bufferSize = 0xffff; - - command = (char*)calloc( bufferSize, 1 ); - - MGdbGoTop( property->availablePortsDb ); - availablePortsDbPortNamePtr = MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir, - property->fieldAvailablePortsDbPortName, exact ); - - if( availablePortsDbPortNamePtr == NULL ) - { - /* - * see if this port has anything special in configDb - */ - MGdbGoTop( property->configDb ); - optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact ); - strcpy( command, "cd " ); - strcat( command, PORTSDIR ); - strcat( command, portDir ); - strcat( command, "; make " ); - strcat( command, " -V PKGNAME " ); - if( optionsPtr ) - { - strcat( command, optionsPtr ); - } - makeStream = popen( command, "r" ); - if( makeStream == 0 ) - { - fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id ); - perror( "system message" ); - return( 1 ); - } - portName[0] = 0; - fread( portName, bufferSize-1, 1, makeStream ); - if( portName == NULL ) - { - fprintf( stdout, "%s error: reading make -V PKGNAME into availablePortName\n", id ); - perror( "system message" ); - return( 1 ); - } - charPtr = portName; - while( charPtr < portName + (bufferSize-1) ) - { - if( charPtr[0] == SPACE || charPtr[0] == TAB || charPtr[0] == LINEFEED || charPtr[0] == ':' ) - { - charPtr[0] = 0; - break; - } - charPtr++; - } - pclose( makeStream ); - } - else - { - MGdbGoTop( property->availablePortsDb ); - strcpy( portName, MGdbSeek( property->availablePortsDb, property->fieldAvailablePortsDbPortDir, portDir, - property->fieldAvailablePortsDbPortName, exact ) ); - } - free( command ); - return( 0 ); -} - int rFillDependencies( structProperty* property, char* availablePortName, char* availablePortDir, int* counterPtr ) { char BUILD_DEPENDS[] = "BUILD_DEPENDS"; @@ -382,7 +314,7 @@ { assert(0); } - rGetPortName( property, dependencyPortDir, dependencyPortName ); + MGPMrGetPortName( property, dependencyPortDir, dependencyPortName ); /* * add dependency to availableDependenciesDb may contain dupes */ diff -ruN ../0.3.4/libMGPM/src/MGPMrStatus.c ./libMGPM/src/MGPMrStatus.c --- ../0.3.4/libMGPM/src/MGPMrStatus.c Mon Nov 7 16:46:00 2005 +++ ./libMGPM/src/MGPMrStatus.c Fri Nov 11 19:37:57 2005 @@ -110,12 +110,7 @@ /* * since installedPortName is no longer in ports collection need to delete record and restart */ - if( ( errorCode = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ) ) ) - { - fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "MGdbDelete", errorCode ); - return( 1 ); - } - + property->installedPortsDb = MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); installedPortsDbQTY = MGdbGetRecordQty( property->installedPortsDb ); installedPortsDbIDX = 1; while( fflush( stdout ) ); diff -ruN ../0.3.4/libMGPM/src/MGPMrUpdate.c ./libMGPM/src/MGPMrUpdate.c --- ../0.3.4/libMGPM/src/MGPMrUpdate.c Thu Nov 10 18:58:41 2005 +++ ./libMGPM/src/MGPMrUpdate.c Fri Nov 11 19:34:03 2005 @@ -461,7 +461,8 @@ MGdbGetRecno( property->availableDependenciesDb ) - 1, property->fieldAvailableDependenciesDbDependencyName ) ); while( fflush( stdout ) ); - MGdbDelete( property->availableDependenciesDb, MGdbGetRecno( property->availableDependenciesDb ) - 1 ); + property->availableDependenciesDb = MGdbDelete( property->availableDependenciesDb, + MGdbGetRecno( property->availableDependenciesDb ) - 1 ); MGdbGoTop( property->availableDependenciesDb ); } /* @@ -1521,7 +1522,7 @@ strcat( curDir, "; make -V .CURDIR" ); buffer[0] = 0; pHandle = popen( curDir, "r" ); - fread( buffer, 255, 1, pHandle ); + fread( buffer, bufferSize, 1, pHandle ); pclose( pHandle ); idx = 0; while( idx < 255 ) @@ -1535,18 +1536,21 @@ } strcpy( curDir, buffer ); - strcpy( command, "rm -r " ); + strcpy( command, "/bin/rm -r " ); strcat( command, workDir ); strcat( command, curDir ); + + strcat( command, "/work 2>&1" ); /* - strcat( command, "/work >/dev/null 2>&1" ); + strcat( command, "/work" ); */ -strcat( command, "/work" ); fprintf( stdout, "===> Cleaning for %s\n", portDir ); -fprintf( stdout, " %s\n", command ); while( fflush( stdout ) ); - system( command ); + buffer[0] = 0; + pHandle = popen( command, "r" ); + fread( buffer, bufferSize, 1, pHandle ); + pclose( pHandle ); free( buffer ); free( command ); free( curDir ); diff -ruN ../0.3.4/libMGPM/src/libMGPM.h ./libMGPM/src/libMGPM.h --- ../0.3.4/libMGPM/src/libMGPM.h Thu Nov 10 15:19:26 2005 +++ ./libMGPM/src/libMGPM.h Fri Nov 11 18:01:02 2005 @@ -181,6 +181,7 @@ } structProperty; +int MGPMrGetPortName( structProperty* property, char* portDir, char* portName ); /* located in MGPMrCreateAllUpdateStatusDb.c */ int MGPMrBestOldPort( structProperty* property, char* oldPortDir, char* oldPortName ); int MGPMrCleanUp( structProperty* property ); int MGPMrCommandLine( int argc, char** argv ); diff -ruN ../0.3.4/portmanager/pkgtools-to-portmanager.rb ./portmanager/pkgtools-to-portmanager.rb --- ../0.3.4/portmanager/pkgtools-to-portmanager.rb Wed Dec 31 16:00:00 1969 +++ ./portmanager/pkgtools-to-portmanager.rb Fri Nov 11 20:54:26 2005 @@ -0,0 +1,59 @@ +#!/usr/local/bin/ruby + +require "pkgtools" + +puts "CATEGORY/PORT|OPTION=| # do not delete this line!" + +load_config + + +# held packages + +puts "" +puts "# Ignored packages from HOLD_PKGS" +puts "" + +config_value(:HOLD_PKGS).each do |pkg| + + puts "IGNORE|" + pkg + "|" + +end + + +# beforebuild becomes stop + +puts "" +puts "# STOP entries come from BEFOREBUILD" +puts "" + +config_value(:BEFOREBUILD).each do |pkg| + + puts "STOP|/" + pkg[0] + " " + pkg[1] + "|" + +end + +# afterinstall becomes start + +puts "" +puts "# START entries come from AFTERINSTALL" +puts "" + +config_value(:AFTERINSTALL).each do |pkg| + + puts "START|/" + pkg[0] + " " + pkg[1] + "|" + +end + +# package options. + + +puts "" +puts "# Package options from MAKE_ARGS" +puts "# Note: pkgtools.conf will use the UNION of all matching lines" +puts "" + +config_value(:MAKE_ARGS).each do |pkg| + + puts pkg[0] + "|" + pkg[1] + "|" + +end diff -ruN ../0.3.4/programmer-notes.txt ./programmer-notes.txt --- ../0.3.4/programmer-notes.txt Fri Nov 11 05:41:28 2005 +++ ./programmer-notes.txt Fri Nov 11 20:56:23 2005 @@ -2,6 +2,8 @@ TODO list + add pkgtools-to-portmanager.rb to tarball + move MGPMrGetPortName from MGPMrCreateAllUpdateStatusDb.c next new tarball to its own file move database files to /var/db/portmanager test in 6.0 use signal to abort only current build? --Boundary-00=_snhdD5U4FRzn2Kf--