haskell / haskell/cabal

Unhelpful error when using cabal.project.local without cabal.project

Open
#9,168 5 comments 0 reactions 0 assignees View on GitHub
re: error-message re: project-file type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
If `cabal.project.local` exists without `cabal.project`, Cabal complains with:
```
Warning: both implicit and explicit configuration is present.When using configuration(s) from /Users/bchinn/Desktop/foo/cabal.project.local, the following errors occurred:
The package location glob './*.cabal' does not match any files or directories.
```

This happens even if `cabal.project.local` contains a `packages:` line.

Also, it seems like a newline is missing after the warning message?

**To Reproduce**
Steps to reproduce the behavior: (fails = shows bug, succeeds = expectedly fails because cabal file is empty)

```bash
mkdir foo
touch foo/foo.cabal
cat 'packages: foo/' >> cabal.project.local

# fails
cabal build

# succeeds with just an empty cabal.project
touch cabal.project
cabal build
```

**Expected behavior**
Renaming `cabal.project` to `cabal.project.local` should have the same behavior.

**System information**
- Mac
- `cabal`: 3.10.1.0

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior with cabal.project.local, a foo/foo.cabal file, and cabal build, then compare it with an empty cabal.project. Trace how Cabal reads these two project configuration files and formats the warning. Done means cabal.project.local alone behaves like cabal.project, including the expected package-location handling and a properly separated warning 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
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.