Quoted component names containing spaces are impossible to refer to

Aperta
#12,207 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
haskell
Ambito
build-system

Direzione di ricerca

Inizia con la riproduzione collegata di quote-component-name-repr e traccia il modo in cui Cabal analizza i nomi dei componenti nelle sezioni library, executable e test, inclusi build-depends e i riferimenti CLI. La correzione è completa quando i nomi tra virgolette contenenti spazi producono un errore di parsing bloccante, con un test di regressione che copra i casi segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

re: internal library type: bug

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:

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 the build-depends field.

    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.

Lingua principale
Haskell
Stelle
1.8k
Fork
766
Merge medio
5g 21h
PR unite (30g)
27

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/cabal

Tutte le issue di haskell/cabal

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.