
#5442: ghc-pkg unregister --user/--global/--package-conf not normative -------------------------------------+------------------------------------- Reporter: guest | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: ghc-pkg | Version: 7.2.1 Resolution: | Keywords: Differential Revisions: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Changes (by ezyang): * owner: bgamari => ezyang Comment: OK, I can confirm that there is something fishy going on here. Here is the matrix of behaviors that ghc-pkg implements right now: * If P is in the user and global, {{{unregister --user}}} removes user, {{{unregister --global}}} removes **USER**, {{{unregister}}} removes user * If P is in the user but not global, {{{unregister --user}}} removes user, {{{unregister --global}}} removes **USER**, {{{unregister}}} removes user * If P is in the global but not user, {{{unregister --user}}} removes **GLOBAL**, {{{unregister --global}}} removes global, {{{unregister}}} removes global This seems clearly wrong. The bug seems to me that ghc-pkg calculates the database to modify fine, but then ignores it in {{{modifyPackage}}}, always using the full database stack rather than the database it calculated to use. My suggested fix is to switch unregister to use the flag package stack, since it is implicitly a read, and then a delete. But I don't know if there is any existing tooling that would be broken by this fix. I have a patch and test-cases. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/5442#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler