Bug in Cabal creating user package.conf

I don't know if this has already been mentioned, but there's a bug in Cabal which I noticed when I tried to configure a package: $ runghc Setup.hs configure ... configure: Reading installed packages... cannot parse package list It turns out Setup created a user package.conf consisting of the two characters "[]" without a newline, which it was then unable to parse. Adding a newline fixed the problem. -- Ashley Yakeley, Seattle WA

Ashley Yakeley
I don't know if this has already been mentioned, but there's a bug in Cabal which I noticed when I tried to configure a package:
$ runghc Setup.hs configure ... configure: Reading installed packages... cannot parse package list
It turns out Setup created a user package.conf consisting of the two characters "[]" without a newline, which it was then unable to parse. Adding a newline fixed the problem.
Hmm. How sure are you that it was cabal that created the package.conf file? This is the code that does so, and it definitely seems to add a newline: -- |If the package file doesn't exist, we should try to create it. If -- it already exists, do nothing and return true. This does not take -- into account whether it is readable or writeable. maybeCreateLocalPackageConfig :: IO Bool -- ^success? maybeCreateLocalPackageConfig = do f <- localPackageConfig exists <- doesFileExist f unless exists $ (try (writeFile f "[]\n") >> return ()) doesFileExist f What platform are you using? Is this a DOS vs Unix line-ending issue? peace, isaac

In article <87ekcsr9u0.fsf@syntaxpolice.org>,
Isaac Jones
Hmm. How sure are you that it was cabal that created the package.conf file? This is the code that does so, and it definitely seems to add a newline:
This is on Mac OS X, and it's definitely Setup.hs that's creating the file, and it definitely has just "[]". Transcript (prompt reduced to "$ " for brevity): $ cat Setup.hs import Distribution.Simple main = defaultMain $ rm -rf ~/.ghc $ runghc Setup.hs configure Warning: Package is copyright All Rights Reserved Warning: No license-file field. Configuring TimeLib-0.1... configure: searching for ghc in path. configure: found ghc at /usr/local/bin/ghc configure: looking for package tool: ghc-pkg near compiler in /usr/local/bin/ghc configure: found package tool in /usr/local/bin/ghc-pkg configure: Using install prefix: /usr/local configure: Using compiler: /usr/local/bin/ghc configure: Compiler flavor: GHC configure: Compiler version: 6.4 configure: Using package tool: /usr/local/bin/ghc-pkg configure: Using haddock: /usr/local/bin/haddock configure: Using happy: /usr/local/bin/happy configure: Using alex: /usr/local/bin/alex configure: Using hsc2hs: /usr/local/bin/hsc2hs configure: No cpphs found configure: Reading installed packages... cannot parse package list $ cat ~/.ghc/powerpc-darwin-6.4/package.conf []$ uname -a Darwin Avebury.local 7.8.0 Darwin Kernel Version 7.8.0: Wed Dec 22 14:26:17 PST 2004; root:xnu/xnu-517.11.1.obj~1/RELEASE_PPC Power Macintosh powerpc $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.4 $ ls -Al ~/.ghc/powerpc-darwin-6.4/package.conf -rw-r--r-- 1 ashley ashley 2 Apr 30 00:57 /Users/ashley/.ghc/powerpc-darwin-6.4/package.conf -- Ashley Yakeley, Seattle WA
participants (2)
-
Ashley Yakeley
-
Isaac Jones