Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#2491 closed feature request (fixed)

ghc-pkg unregister should complain about breaking dependent packages

Reported by: duncan Owned by: simonmar
Priority: normal Milestone:
Component: Compiler Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Currently it is easy to silently break installed packages. This is particularly bad when users unregister things like 'old' versions of Cabal or bytestring (usually after having installed a new version) because this breaks packages like the ghc api package which cannot be re-installed.

So ghc-pkg unregister should report an error if there are packages that depend on the package being unregistered (at least within the same package db). The error message should report which packages still need the package that the user was trying to unregister and should mention that if they're really really sure that they want to break other said packages that they can run the command again with --force. With --force inplace it should probably still print the warning (for the benefit of log files in packaging systems that may need to use --force if they do not guarantee an order of unregistering).

Example user interaction:

$ ghc-pkg unregister bytestring-
ghc-pkg: bytestring- should not be unregistered
because the following registered packages depend on it:
Use --force to unregister anyway and break these packages.
You can use ghc-pkg check at any time to see what packages
in the broken state due to missing dependencies.

$ ghc-pkg unregister bytestring- --force
ghc-pkg: Warning: due to the forced unregistering of the
package bytestring-, the following packages are now
in the broken state:

Incidentally, we should also install a package.conf.shipped to help people recover their ghc installations after they've unwisely and over-zealously gone round unregistering 'old' packages. Debian and Gentoo already do this and it's saved many users.

Change History (4)

comment:1 Changed 9 years ago by simonmar

difficulty: Unknown
Owner: set to simonmar

comment:2 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed


Wed Aug 13 15:25:55 BST 2008  Simon Marlow <>
  * FIX #2491 (ghc-pkg unregister should complain about breaking dependent packages)

comment:3 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple
Note: See TracTickets for help on using tickets.