Repl started with --enable-multi-repl **and** _without_ passing the name of an executable in a project with the unnamed library stanza, inherits a different PATH than otherwise

Aperta
#12,122 1 commento 1 reazione 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
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
haskell
Ambito
build-system, cli

Direzione di ricerca

Riproduci il problema usando i file foo.cabal e cabal.project descritti, quindi esegui ogni comando cabal repl elencato e confronta :! echo $PATH con :! ghc --version. Inizia dalla gestione di cabal repl per la sezione della libreria senza nome e dal comportamento di --enable-multi-repl. Il lavoro è completato quando tutti e quattro i comandi ereditano lo stesso PATH e selezionano la versione di GHC prevista.

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

Descrizione

type: bug

Describe the bug
Given a foo.cabal file with library and executable exe stanzas, the repl started with any of these 3 commands

  • cabal repl,
  • cabal repl exe,
  • cabal repl --enable-multi-repl exe

inherits a different PATH than if it was started with this command:

  • cabal repl --enable-multi-repl

To Reproduce

Create a project with this directory structure:

.
├── cabal.project
├── exe
│   └── Exe.hs
├── foo.cabal
└── lib
    └── Lib.hs

3 directories, 4 files

where

  • cabal.project contains
    packages: .
    
  • foo.cabal contains
    cabal-version: 3.4
    name:          foo
    version:       0
    
    library
        build-depends: base
        exposed-modules: Lib
        hs-source-dirs: lib
    
    executable exe
        build-depends: base
        hs-source-dirs: exe
        main-is: Exe.hs
    
  • Lib.hs contains
    module Lib () where
    
  • and Exe.hs contains
    main :: IO ()
    main = putStrLn "Hello World"
    

With the above, start the repl via these 3 commands

  • cabal repl,
  • cabal repl exe,
  • cabal repl --enable-multi-repl exe

and in each of the repls, issue both :! echo $PATH and :! ghc --version.

The latter command reports the GHC version selected in GHCup at that moment, as expected.

Now, run this 4th command:

  • cabal repl --enable-multi-repl

and issue both :! echo $PATH and :! ghc --version.

The output will be different, and in particular :! ghc --version reports - unexpectedly to me - GHC 9.6.6.

Why is that?

Expected behavior
All 4 cabal repl ... commands should inherit the same PATH.

System information

  • up-to-date ArchLinux
  • XMonad installed via pacman
    • this brings in the dependency on the ghc, version 9.6.6
  • cabal 3.16.1.0 installed via GHCup 0.2.6.2,
  • ghc 9.14.1 and 9.12.2 installed via GHCup 0.2.6.2

Additional context

I've searched, but haven't found anything that strikes me as the same issue.

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.