haskell / haskell/cabal

`cabal install` prints unhelpful error when .cabal filename does not match the package name

Open
#7,322 10 comments 0 reactions 0 assignees View on GitHub
blocked: decision-needed cabal-install: cmd/install re: error-message type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

In a project where the `.cabal` file has underscores in the name, `cabal install` fails with an unhelpful error message:

```
dieVerbatim: user error (cabal: Package .cabal file not found in the tarball:
/tmp/cabal-install.-42328/dist-newstyle/tmp/src-42328/note-graph-0.0.0.0/note-graph.cabal
)
```

After much head-scratching, I realized the problem was I needed to rename `note_graph.cabal` to `note-graph.cabal`.

**To Reproduce**
Steps to reproduce the behavior:

* Put the following in a file called `a_b.cabal`.
```
cabal-version: 2.2
name: a-b
version: 0.0.0.0
build-type: Simple

executable x
default-language: Haskell2010
build-depends: base
main-is: Main.hs
```
* Put something in `Main.hs`.
* `cabal v2-install .:x`

**Expected behavior**

One of the following would be preferrable:
* The installation works.
* Cabal prints an error like `Your .cabal file should not have underscores in the name.`

**System information**
OpenBSD current

I've got custom-built `ghc` and `cabal-install` ports; let me know if you'd like me to retry with an unmodified install.

```falsifian moth d $ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.4
falsifian moth d $ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with an a_b.cabal file declaring package name a-b, then run cabal v2-install .:x and inspect how cabal-install locates the package file in the generated tarball. Done means installation succeeds or the command reports clearly that the .cabal filename must match the package name.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.