Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

cabal: Couldn't read cabal file ".\\HaTeX\\1.0.0\\HaTeX.cabal" #705

Closed
bos opened this Issue · 7 comments

2 participants

@bos
Owner

(Imported from Trac #714, reported by guest on 2010-07-20)

I have a similar error than exposed in Ticket#677.

This error appears when I try to install the HaTeX package:

cabal: Couldn't read cabal file ".\HaTeX\1.0.0\HaTeX.cabal"

Even when I'm installing version 1.0.1.

A link to the package in Hackage:

http://hackage.haskell.org/package/HaTeX

Note that the same error appears in Hackage.

I'm the author of the package, and I want a fix for him. But I don't know how to attack the problem, because error appears before reading a new version of the package (When "Resolving dependencies...").

@bos
Owner

(Imported comment by @dcoutts on 2010-07-20)

So the problem here is that the HaTeX.cabal file uses a BOM (a byte order mark). Newer Cabal lib versions will happily ignore the BOM at the beginning of the file but older versions will not.

The hackage upload checker uses the new code so it accepts the package. We could allow the BOM when the package declares that it needs a sufficiently recent Cabal version, or we could make hackage reject packages that use the BOM. In the mean time we should just edit the HaTex?.cabal in the index on the server to remove the BOM.

With the current code it's a bit tricky to check for the BOM because it is discarded when reading the file.

@bos
Owner

(Imported comment by ross on 2010-07-28)

Does this need a development version?

% cabal --version
cabal-install version 0.8.2
using version 1.8.0.6 of the Cabal library
% cabal install HaTeX-1.0.1
Resolving dependencies...
cabal: Couldn't read cabal file "./HaTeX/1.0.0/HaTeX.cabal"
The error message is suboptimal too.

@bos
Owner

(Imported comment by @dcoutts on 2010-07-28)

Ah, found the problem.

When we read a .cabal file from disk we use readUTF8File which ignores the BOM. We do not do the same when reading the .cabal entry from the index tarball in cabal-install.

Really we should make parsePackageDescription take a ByteString and have it do all the decoding (utf, bom, line ending conversion) there in a single place.

Ross: the temporary solution is to change the hackage-scripts upload script to read the .cabal file from disk using a modified readUTF8File that does not ignore the BOM:

readUTF8File_LeavingBOMIntact :: FilePath -> IO String
readUTF8File_LeavingBOMIntact f = fmap fromUTF8
. hGetContents =<< openBinaryFile f ReadMode
We should also edit the two HaTex? .cabal files in the current archive to strip off the BOM.

@bos
Owner

(Imported comment by @dcoutts on 2010-07-30)

Btw, as for the bad error message. It's a bit tricky the way we have it at the moment. Currently we lazily parse the .cabal entries and call error if it fails. So we cannot give different errors in different places. Ticket #288 is about handling the index better, we would read the index tarball after download, parse them all then (giving suitable errors/warnings) and write out a new index in an internal form that is faster and does not need further checking/parsing.

@bos
Owner

(Imported comment by ross on 2010-07-30)

Replying to @dcoutts:

Ross: the temporary solution is to change the hackage-scripts upload script to read the .cabal file from disk using a modified readUTF8File that does not ignore the BOM:

Is the idea to make the upload fail by triggering a parse error?

@bos
Owner

(Imported comment by @dcoutts on 2010-07-30)

Replying to ross:

Is the idea to make the upload fail by triggering a parse error?

Either that or checking for the BOM explicitly.

@gregorycollins

Is this still an issue? It hasn't been touched in almost three years, and it looks like Hackage successfully built HaTeX 1.0.1 with GHC 6.12. Closing as obsolete, please reopen otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.