-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error message when multiple .cabal files are in the same directory #7395
Comments
Related: #6197 |
The error is especially unhelpful if there is only one package:
Removing This is a reproducer (for at least 3.0, 3.2, 3.4, 3.6.2, master): #!/bin/sh
cd $(mktemp -d)
${CABAL:-cabal} init -n --exe --package-name=IExistOnlyOnce
cat > cabal.project.local <<EOF
packages: IExistOnlyOnce.cabal
package *
ghc-options: -Wall
EOF
${CABAL:-cabal} build Error:
Not reproducible in 2.4.1. |
The issue posted before #6197 also mentions that |
Oh, there's another fun way to cause this bug: do this:
Surprisingly, I've hit this multiple times by accident. |
The whole approach how cabal.project files are tracked and handled need to be redesigned with good error messages in mind. The PR #7396 only fixes a single symptom, I believe we need to change the Semigroup instance of project files to include more provenance information. Would love to work on it, but I am a little overextended at the moment. If someone else wants to work on it, I'd be very happy to explain my thoughts in more detail and pair a bit to show what I think needs to be fixed. |
Oh yes, I got stumped by this a couple of ears ago. Perhaps in a variant, where both places have |
Describe the bug
Improve error message when multiple .cabal files are in the same directory
To Reproduce
Have two .cabal files in the sme directory. Example
Expected behavior
No callstack should be shown, nor a big TODO.
System information
cabal 3.4
installed via ghcupThe text was updated successfully, but these errors were encountered: