Quoted component names containing spaces are impossible to refer to
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- haskell
- Domain
- build-system
Research direction
Start with the linked quote-component-name-repr reproduction and trace how Cabal parses component names in library, executable, and test sections, including build-depends and CLI references. The fix is done when quoted names containing spaces produce a hard parse error, with a regression test covering the reported cases.
Written by the indexing model from the issue text.
Description
Describe the bug
In the library, executable or test section it is possible to define a library with name within quotes.
By quoting the name, the library name can contain spaces.
When a library name contains spaces, it is impossible to refer to it in a build-depends fields because quotes are not allowed.
It is also impossible to refer to it in the CLI.
Cabal doesn't stop the user from quoting component name, nor from putting spaces.
There are in total only roughly 78 cabal files that does this on Hackage.
To Reproduce
Steps to reproduce the behavior:
- Go to the repository https://github.com/leana8959/cabal-quote-component-name-repr
- See the steps to reproduce the error.
TL;DR:
-
Add a trailing space to my-lib, and you won't be able to refer to it in the executable.
It is not possible to put quotes in thebuild-dependsfield.Building the executable when the executable doesn't depend on the library would work.
There's no hard parse error. -
Add a trailing space to my-exe, and the executable will have a space in its name.
Here's a silly example:
Preprocessing library 'my-lib' for quote-component-name-repr-0.1.0.0... Building library 'my-lib' for quote-component-name-repr-0.1.0.0... Configuring executable '" m y - e x e "' for quote-component-name-repr-0.1.0.0... Preprocessing executable '" m y - e x e "' for quote-component-name-repr-0.1.0.0... Building executable '" m y - e x e "' for quote-component-name-repr-0.1.0.0... [1 of 1] Compiling Main [2 of 2] Linking dist-newstyle/build/x86_64-linux/ghc-9.10.3/quote-component-name-repr-0.1.0.0/x/" m y - e x e "/build/ m y - e x e / m y - e x e
Expected behavior
Quotes in component names should be a hard parse error.
System information
- Operating system: NixOS 26.05
cabal: 10aed4eb5e3149cd25f162fd2b0def06347baa66,- ghc: 9.10.3 from nixpkgs
Additional context
Add any other context about the problem here.
- Dominant language
- Haskell
- Stars
- 1.8k
- Forks
- 766
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell/cabal
-
needs triage type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 3 days
-
needs triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
haskell/cabal#12568 · 1 comment ·
Maintainers usually reply within 3 days
-
needs triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
haskell/cabal#12525 · 3 comments · 1 reaction ·
Maintainers usually reply within 3 days
-
Required version of `cabal-install` to build CabalPossibly taken @philderbeast claimed this 24 days ago. Opendocumentation type: discussion
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
haskell/cabal#12477 · 2 comments · 1 assignee ·
Maintainers usually reply within 3 days
-
Document which are our LTS releasesPossibly taken @KeuqS claimed this 41 days ago. Opendocumentation type: discussion
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
haskell/cabal#12373 · 2 comments ·
Maintainers usually reply within 3 days
Similar issues
-
bug desktop
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
simplex-chat/simplex-chat#8291 ·
Maintainers usually reply within 1 day
-
[BUG]: C# programs with top-level statements fail to compilePossibly taken @AsyncNigam claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
compiler-explorer/compiler-explorer#9625 · 1 comment ·
Maintainers usually reply within 1 day
-
reflex-0.10Open
Difficulty 1/5 Under an hour Newbie friendliness 62/100
commercialhaskell/stackage#8180 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenZeppelin/canton-contracts#140 ·
Maintainers usually reply within 1 day
-
takeInterval yields nothing, dropInterval drops nothingPossibly taken @GuillaumedeVolpiano claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
composewell/streamly#3271 ·