cabal update tries to parse the cabal file
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I suppose a `cabal update` should not try to parse any cabal files, but it seems it does:
https://github.com/haskell/hackage-security/actions/runs/7225301302/job/19688442982#step:3:55
```
/home/runner/.ghcup/bin/cabal update
Errors encountered when parsing cabal file hackage-security/hackage-security.cabal:
hackage-security/hackage-security.cabal:126:24: error:
unexpected 'p'
expecting space, "&&", white space, "||", comma or end of input
125 | mtl >= 2.2 && < 2.4
126 | parsec >= 3.1 && < 3.2,
| ^
```
cabal version is 3.10.2.0.
This is the relevant cabal.project: https://github.com/haskell/hackage-security/blob/91904dec0ebb77a1a671be511f71624803bb9721/cabal.project
Note that `cabal update` is not a project-level command, but concerns only the package database; from the `cabal help` text:
```
[package database]
update Updates list of known packages.
list List packages matching a search string.
info Display detailed information about a particular package.
```
Reproducer:
After `cabal init`, introduce an error in the generated `.cabal` file and then run `cabal update`.
E.g.
```cabal
cabal-version: 3.8
name: cabal-update-parses-cabal-file
version: 0
build-type: Simple
executable cabal-update-parses-cabal-file
main-is: Main.hs
hs-source-dirs: app
-- MISSING COMMA:
build-depends: base filepath
```
Contributor guide
Assessment
This issue has not been assessed yet.