bin/115327: [patch] "pkg_delete -a" causes segmentation fault for package with broken dependency

Michael Zhilin mizhka at gmail.com
Wed Aug 8 13:00:13 PDT 2007


>Number:         115327
>Category:       bin
>Synopsis:       [patch] "pkg_delete -a" causes segmentation fault for package with broken dependency
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 08 20:00:12 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Michael Zhilin
>Release:        FreeBSD 7.0-CURRENT #1
>Organization:
>Environment:
FreeBSD reba 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Wed Aug  1 06:13:10 MSD 2007     mizh at reba:/usr/obj/usr/src/sys/KRNL7  i386
>Description:
After year usage of FreeBSD as desktop the package system has contained a lot of broken dependencies, lost libraries (lib files without appropriate package) and other garbage. And of course, after updating to 7.0-current, some applications don't have been runnable (some errors with libthr have occured). It was reason for cleaning of system.

# pkg_deinstall -a
.. a lot of packages was deleted ...

# pkg_info 
.. 2 packages wasn't deleted ... 

pkg_deinstall was removed and a try to run "pkg_delete -a" causes following:
# pkg_delete -a
pkg_delete: Segmentation fault (core dumped)

After compilation with debug options gdb's given me a reason:
NULL pointer causes fault at /src/usr.sbin/pkg_install/delete/perform.c:line 266
>How-To-Repeat:
I think it was broken dependency
>Fix:
The attached patch works for me.

Patch attached with submission follows:

--- perform.c	2004-06-29 23:06:41.000000000 +0400
+++ perform.c.new	2007-08-08 22:33:33.000000000 +0400
@@ -266,7 +266,7 @@
     for (p = Plist.head; p ; p = p->next) {
 	if (p->type != PLIST_PKGDEP)
 	    continue;
-	deporigin = (p->next->type == PLIST_DEPORIGIN) ? p->next->name :
+	deporigin = ( p->next != NULL && p->next->type == PLIST_DEPORIGIN) ? p->next->name :
 							 NULL;
 	if (Verbose) {
 	    printf("Trying to remove dependency on package '%s'", p->name);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list