| Summary: | pkg_delete clears dependencies after running post-deinstall script. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | sburke <sburke> |
| Component: | bin | Assignee: | Oliver Eikemeier <eik> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->patched awaiting MFC Responsible Changed From-To: freebsd-bugs->eik Handle State Changed From-To: patched->closed MFC finished, thanks! |
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