Open falsifian opened 3 years ago
@falsifian thanks for reporting the error which i can reproduce with last cabal-3.4.0.0 Points to consider:
cabal v2-build
lets you build packages which .cabal file name differs from the package name described in that file (it is any difference ,not only between -
and _
)cabal install
generates a package.tar distribution file and then uses it to install the package like it would downloaded it from hackage. This install from a tar file needs that the .cabal file name matches exactly the package name, so it failscabal check
tell us:PS D:\dev\ws\haskell\cabal-test> cabal check
Warning: The filename .\cabal_test.cabal does not match package name
(expected: cabal-test.cabal)
Warning: Hackage would reject this package.
So we could do:
cabal check
in an error for cabal install
and cabal build
cabal install
to match the behaviour of cabal build
and not throw an error only for local tars generated by cabal install itself, i guess it will be trickycabal install
using the same code cabal check
uses to print the warningImo the build and install behaviour should be coherent and throw an error, but if it is already a warning is cause someone would be using .cabal names different from package names locally (???). So i would vote for 2, although 3 will be easier to implement i guess
@jneira Thanks for the analysis. I don't have strong opinions or intimate knowledge of cabal, so I'll leave the discussion to others here and in #6299. I've learned the lesson already, so it's not a problem for me unless I forget :)
As a easier to do improvement, we could improve the actual error message, without touching actual semantics
Describe the bug
In a project where the
.cabal
file has underscores in the name,cabal install
fails with an unhelpful error message:After much head-scratching, I realized the problem was I needed to rename
note_graph.cabal
tonote-graph.cabal
.To Reproduce Steps to reproduce the behavior:
a_b.cabal
.executable x default-language: Haskell2010 build-depends: base main-is: Main.hs