Bug 26468

Summary: pkg_delete clears dependencies after running post-deinstall script.
Product: Base System Reporter: sburke <sburke>
Component: binAssignee: Oliver Eikemeier <eik>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description sburke 2001-04-09 22:30:01 UTC
pkg_delete does not clear the +REQUIRED_BY entries in the deleted 
package's dependencies until after running the post-deinstall script.
As a result, if the post-deinstall script attempts to delete other
packages that are required by the package being deleted, those packages
cannot be deleted because they appear to still be required.

Fix: 

In /usr/src/usr.sbin/pkg_install/delete/perform.c,
move the loop beginning at line 258:

    for (p = Plist.head; p ; p = p->next) {
        if (p->type != PLIST_PKGDEP)
            continue;
        if (Verbose)
            printf("Attempting to remove dependency on package `%s'\n", p->name);
        if (!Fake)
            undepend(p, pkg);
    }

To line 225, following the call to delete_package().

This will ensure that the package dependencies are up to date
when the post-deinstall script is called.
How-To-Repeat: Create a package Foo-1.0, with "@pkgdep Bar-1.0" in the pkg-plist.
Next, in Foo's post-deinstall script, do "pkg_delete Bar-1.0".
Deleting the package Foo-1.0 generates the error:
pkg_delete: package `Bar-1.0' is required by these other packages
and may not be deinstalled 
Foo-1.0
Comment 1 Oliver Eikemeier freebsd_committer freebsd_triage 2004-06-29 20:31:51 UTC
State Changed
From-To: open->patched

awaiting MFC 


Comment 2 Oliver Eikemeier freebsd_committer freebsd_triage 2004-06-29 20:31:51 UTC
Responsible Changed
From-To: freebsd-bugs->eik

Handle
Comment 3 Oliver Eikemeier freebsd_committer freebsd_triage 2004-08-13 18:09:05 UTC
State Changed
From-To: patched->closed

MFC finished, thanks!