Date: Fri, 4 Nov 2005 09:30:20 GMT From: "Michael C. Shultz" <ringworm01@gmail.com> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/88478: [NON-MAINTAINER] sysutils/portmanager update to 0.3.1 Message-ID: <200511040930.jA49UKHs005978@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/88478; it has been noted by GNATS. From: "Michael C. Shultz" <ringworm01@gmail.com> To: bug-followup@freebsd.org, ringworm01@gmail.com Cc: Subject: Re: ports/88478: [NON-MAINTAINER] sysutils/portmanager update to 0.3.1 Date: Fri, 4 Nov 2005 01:15:04 -0800 --Boundary-00=_ZayaDWE6PqFEMa3 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline portmanager is going to segfault if a port has been removed from the tree, this patch corrects that, mind dropping it in files? Thanks, Mike --Boundary-00=_ZayaDWE6PqFEMa3 Content-Type: text/x-diff; charset="us-ascii"; name="patch-0.3.1_01" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-0.3.1_01" diff -ruN ../0.3.1/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c --- ../0.3.1/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 3 18:28:24 2005 +++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Fri Nov 4 01:02:20 2005 @@ -44,6 +44,7 @@ char* availablePortName = NULL; char* installedPortsDbPortDirPtr = NULL; int bufferSize = 0xffff; + int errorCode = 0; int installedPortsDbIDX = 0; int installedPortsDbQTY = 0; @@ -114,10 +115,10 @@ } strcpy( availablePortDir, installedPortsDbPortDirPtr ); - if( rrFindDepends( property, availablePortDir, availablePortName ) ) + if( ( errorCode = rrFindDepends( property, availablePortDir, availablePortName ) ) == 100 ) { - fprintf( stdout, "%s %s error: rrFindDepends returned with an errorn", id, PACKAGE_VERSION ); - return( 1 ); + MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); + installedPortsDbQTY--; } installedPortsDbIDX++; } @@ -139,8 +140,10 @@ if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) ) { +/* fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rrGetPortName", errorCode ); - return( 1 ); +*/ + return( 100 ); } MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "0", NULL); @@ -173,6 +176,7 @@ int rrGetPortName( structProperty* property, char* portDir, char* portName ) { + DIR* dirStream = NULL; FILE* makeStream = NULL; char exact[] = "exact"; char id[] = "rrGetPortName"; @@ -180,6 +184,7 @@ char* charPtr = NULL; char* command = NULL; char* optionsPtr = NULL; + int answer = 0; int bufferSize = 0xffff; command = (char*)calloc( bufferSize, 1 ); @@ -195,6 +200,48 @@ */ MGdbGoTop( property->configDb ); optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact ); +/******************/ + strcpy( command, PORTSDIR ); + strcat( command, portDir ); + dirStream = opendir( command ); + if( dirStream == 0 ) /* bad dir */ + { + 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\nis it OK to remove %s from your system? [y/n]\n", + portName, portDir, portName ); + while( fflush( stdout ) ); + answer = getc(stdin); + + if( answer != 89 && answer != 121 ) + { + fprintf( stdout, "answer = %d\n", answer ); + fprintf( stdout, "you will have to deal with this manually then, portmanager shutting down\n" ); + exit(0); + } + answer = getc(stdin); + + fprintf( stdout, "removing: %s\n", portName ); + strcpy( command, "pkg_delete -f " ); + strcat( command, portName ); + fprintf( stdout,"%s\n", command ); + fprintf( stdout,"%s\n", SINGLE_LINES ); + while( fflush( stdout ) ); + system( command ); + free( command ); + return( 100 ); + } + else + { + closedir( dirStream ); + } +/*****************/ strcpy( command, "cd " ); strcat( command, PORTSDIR ); strcat( command, portDir ); diff -ruN ../0.3.1/patch-0.3.1_01 ./patch-0.3.1_01 --- ../0.3.1/patch-0.3.1_01 Wed Dec 31 16:00:00 1969 +++ ./patch-0.3.1_01 Fri Nov 4 01:03:16 2005 @@ -0,0 +1,102 @@ +diff -ruN ../0.3.1/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c +--- ../0.3.1/libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Thu Nov 3 18:28:24 2005 ++++ ./libMGPM/src/MGPMrCreateAllUpdateStatusDb.c Fri Nov 4 01:02:20 2005 +@@ -44,6 +44,7 @@ + char* availablePortName = NULL; + char* installedPortsDbPortDirPtr = NULL; + int bufferSize = 0xffff; ++ int errorCode = 0; + int installedPortsDbIDX = 0; + int installedPortsDbQTY = 0; + +@@ -114,10 +115,10 @@ + + } + strcpy( availablePortDir, installedPortsDbPortDirPtr ); +- if( rrFindDepends( property, availablePortDir, availablePortName ) ) ++ if( ( errorCode = rrFindDepends( property, availablePortDir, availablePortName ) ) == 100 ) + { +- fprintf( stdout, "%s %s error: rrFindDepends returned with an errorn", id, PACKAGE_VERSION ); +- return( 1 ); ++ MGdbDelete( property->installedPortsDb, installedPortsDbIDX ); ++ installedPortsDbQTY--; + } + installedPortsDbIDX++; + } +@@ -139,8 +140,10 @@ + + if( ( errorCode = rrGetPortName( property, availablePortDir, availablePortName ) ) ) + { ++/* + fprintf( stdout, "%s %s error: %s returned errorCode %d\n", id, PACKAGE_VERSION, "rrGetPortName", errorCode ); +- return( 1 ); ++*/ ++ return( 100 ); + } + + MGdbAdd( property->availablePortsDb, availablePortName, availablePortDir, "0", NULL); +@@ -173,6 +176,7 @@ + + int rrGetPortName( structProperty* property, char* portDir, char* portName ) + { ++ DIR* dirStream = NULL; + FILE* makeStream = NULL; + char exact[] = "exact"; + char id[] = "rrGetPortName"; +@@ -180,6 +184,7 @@ + char* charPtr = NULL; + char* command = NULL; + char* optionsPtr = NULL; ++ int answer = 0; + int bufferSize = 0xffff; + + command = (char*)calloc( bufferSize, 1 ); +@@ -195,6 +200,48 @@ + */ + MGdbGoTop( property->configDb ); + optionsPtr = MGdbSeek( property->configDb, property->fieldConfigDbKey, portDir, property->fieldConfigDbValue, exact ); ++/******************/ ++ strcpy( command, PORTSDIR ); ++ strcat( command, portDir ); ++ dirStream = opendir( command ); ++ if( dirStream == 0 ) /* bad dir */ ++ { ++ 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\nis it OK to remove %s from your system? [y/n]\n", ++ portName, portDir, portName ); ++ while( fflush( stdout ) ); ++ answer = getc(stdin); ++ ++ if( answer != 89 && answer != 121 ) ++ { ++ fprintf( stdout, "answer = %d\n", answer ); ++ fprintf( stdout, "you will have to deal with this manually then, portmanager shutting down\n" ); ++ exit(0); ++ } ++ answer = getc(stdin); ++ ++ fprintf( stdout, "removing: %s\n", portName ); ++ strcpy( command, "pkg_delete -f " ); ++ strcat( command, portName ); ++ fprintf( stdout,"%s\n", command ); ++ fprintf( stdout,"%s\n", SINGLE_LINES ); ++ while( fflush( stdout ) ); ++ system( command ); ++ free( command ); ++ return( 100 ); ++ } ++ else ++ { ++ closedir( dirStream ); ++ } ++/*****************/ + strcpy( command, "cd " ); + strcat( command, PORTSDIR ); + strcat( command, portDir ); diff -ruN ../0.3.1/portmanager/portmanager.1 ./portmanager/portmanager.1 --- ../0.3.1/portmanager/portmanager.1 Thu Nov 3 19:41:21 2005 +++ ./portmanager/portmanager.1 Thu Nov 3 21:19:00 2005 @@ -60,7 +60,7 @@ .sp .It \fB\&-f\fR or \fB\&--fix\fR - force building of all dependencies in single update mode, see examples + force building of all dependencies, see examples .sp .It \fB\&-bu\fR or \fB\&--back-up\fR Binary files ../0.3.1/portmanager-0.3.1.tar.gz and ./portmanager-0.3.1.tar.gz differ --Boundary-00=_ZayaDWE6PqFEMa3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511040930.jA49UKHs005978>