Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#2441 closed bug (fixed)

Ghc-pkg cannot unregister/expose/hide packages in non-first package databases

Reported by: batterseapower Owned by: simonmar
Priority: normal Milestone: 6.10.1
Component: Build System Version: 6.9
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I was in this situation:

$ ghc-pkg list
/usr/local/lib/ghc-6.8.2/package.conf:
    Cabal-1.2.3.0, Cabal-1.5.1, Finance-Quote-Yahoo-0.4.1,
    GLUT-2.1.1.1, HTTP-3001.0.4, HTTP-Simple-0.1, HUnit-1.2.0.0,
    OpenAL-1.3.1.1, QuickCheck-1.1.0.0, array-0.1.0.0, base-3.0.1.0,
    binary-0.4.1, bytestring-0.9.0.1, cgi-3001.1.5.1,
    containers-0.1.0.1, directory-1.0.0.0, fgl-5.4.1.1,
    filepath-1.1.0.0, (ghc-6.8.2), haskell-src-1.0.1.1,
    haskell98-1.0.1.0, hpc-0.5.0.0, html-1.0.1.1, hxt-7.4, mtl-1.1.0.0,
    network-2.1.0.0, old-locale-1.0.0.0, old-time-1.0.0.0,
    packedstring-0.1.0.0, parallel-1.0.0.0, parsec-2.1.0.0,
    plugins-1.0, plugins-1.1, pretty-1.0.0.0, process-1.0.0.0,
    random-1.0.0.0, readline-1.0.1.0, regex-base-0.72.0.1,
    regex-compat-0.71.0.1, regex-posix-0.72.0.2, rts-1.0, stm-2.1.1.0,
    template-haskell-2.2.0.0, time-1.1.2.0, unix-2.3.0.0,
    xhtml-3000.0.2.1, zlib-0.4.0.4
/Users/mbolingbroke/.ghc/i386-darwin-6.8.2/package.conf:
    Cabal-1.4.0.0, GLUT-2.1.1.1, HDBC-1.1.4, MaybeT-0.1.1,
    MonadRandom-0.1.1, OpenGL-2.2.1.1, Stream-0.2.3, arrows-0.4,
    category-extras-0.53.4, haddock-2.1.0

And from there I can do this:

$ ../../../../ghc.plugins/utils/ghc-pkg/ghc-pkg-inplace describe pan-plugin-annotations
name: pan-plugin-annotations
version: 1.0
license: BSD3
copyright: (c) Sean Seefried 2008
maintainer: sseefried@cse.unsw.edu.au
stability: stable
homepage:
...

But not this!

$ ../../../../ghc.plugins/utils/ghc-pkg/ghc-pkg-inplace expose pan-plugin-annotations-1.0
ghc-pkg-inplace: cannot find package pan-plugin-annotations-1.0

Or this:

$ ../../../../ghc.plugins/utils/ghc-pkg/ghc-pkg-inplace hide pan-plugin-annotations-1.0
ghc-pkg-inplace: cannot find package pan-plugin-annotations-1.0

The reason is that ghc-pkgs modifyPackage function only looks in the FIRST package database in the list. In my opinion, it should look in all databases and either:

  1. Perform the modification requested by the user to the first database that contains the relevant package
  1. Show a smart error message indicating to the user that they need to use some flags to bring that package to the front of the package stack if they want to do that, rather than just saying "not found"

I've attached a patch that implements behaviour 1.

Attachments (1)

FixHideExposeRegisterForNonFirstPackageDB.patch (61.3 KB) - added by batterseapower 6 years ago.
Patch implementing behaviour 1

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by batterseapower

Patch implementing behaviour 1

comment:1 Changed 6 years ago by duncan

Similarly we notice in #haskell that frequently people are very confused by ghc-plg list saying that a package is installed but then unregistering fails (because they do not understand the --user issue). This confusion is on the rise because cabal-install now does per-user installs by default which means there are more people with per-user packages registered and since they never had to use the --user flag in the first place they are unaware of the whole concept of global vs user package dbs..

Either different default behaviour or a better error message would be an improvement. For example at least the error message should note that the package is in the --user db and that if they should use that flag.

comment:2 Changed 6 years ago by simonmar

  • Difficulty set to Unknown
  • Milestone set to 6.10.1

comment:3 Changed 6 years ago by simonmar

  • Owner set to simonmar

comment:4 Changed 6 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

Fixed. I modified the submitted patch to do the right thing, and fixed up some other bogosity that I found along the way. Also I added a test to the testsuite.

Thu Aug 14 13:53:48 BST 2008  Simon Marlow <marlowsd@gmail.com>
  * Fix #2441 (unregister/expose/hide packages in non-first package databases)

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:6 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.