haskell / haskell/cabal

Confusing error message when project contains duplicates in 'packages' declaration

Open
#6,197 14 comments 0 reactions 0 assignees View on GitHub
cabal-install: v2-build system type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
I see the following behavior:

```
% cabal v2-repl
Resolving dependencies...
TODO: add support for multiple packages in a directory
CallStack (from HasCallStack):
error, called at ./Distribution/Client/ProjectOrchestration.hs:532:9 in main:Distribution.Client.ProjectOrchestration
CallStack (from -prof):
Distribution.Client.ProjectOrchestration.resolveTargets (Distribution/Client/ProjectOrchestration.hs:(502,1)-(608,34))
Distribution.Client.ProjectOrchestration.CAF ()
1.10s user 0.16s system 98% cpu 1.282 total
zsh: exit 1
```

**To Reproduce**
Set up a directory that matches mine:

```
% tree
.
├── a
│ └── a.cabal
└── b
├── b.cabal
└── cabal.project.local

2 directories, 3 files
% cat a/a.cabal
name: a
version: 0.1.0.0
build-type: Simple
% cat b/b.cabal
name: b
version: 0.1.0.0
build-type: Simple
% cat b/cabal.project.local
packages: ./
../a/
```

Navigate to the `b` directory, then run `cabal v2-repl`.

**System information**
```
% cabal --version
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library
```

Contributor guide

Open the contributing guide

Research direction

Start by reading Distribution/Client/ProjectOrchestration.hs around resolveTargets, especially the error at line 532, and reproduce the command from the issue in the b directory. Trace how the packages entries ./ and ../a/ are resolved. Done means cabal v2-repl reports the duplicate-package situation with a clear diagnostic instead of the current TODO message.

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
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.