"ghc-pkg --user describe '*'" fails with empty user db
|Reported by:||duncan||Owned by:|
|Type of failure:||Test Case:|
|Related Tickets:||Differential Rev(s):|
With ghc 6.9 and later Cabal uses the new "ghc-pkg describe '*'" interface to get info out of ghc-pkg about all the installed packages. It makes one call for each package db, for --global and --user (and any other dbs the user specifies). The --user flag now means to list only the packages from the user db and not the ones from the global one too. It's quite possible that the user package db is empty (or equivalently that the file does not exist yet).
So what goes wrong is that the new search feature treats an empty search result as a failure. That's obviously a useful thing for some queries but is extremely unhelpful for what Cabal wants. It means Cabal fails to configure anything when the user package db is empty because it does not expect ghc-pkg to fail. This blocks the current Cabal HEAD from working with ghc HEAD.
I'd like to put in another request for the ghc-pkg dump feature that I suggested originally. It would just dump all the packages in the describe format. The difference is that it is not a query so we do not fail if the result set is empty. Also, dump should not produce helpful human readable error output like "ghc-pkg: cannot find package matching *" because that will upset Cabal's parser.