Switching between Cabal 3.18.1.0 and 3.18.2.0 breaks one or the other

Aperta
#12,622 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

The report identifies haskell-language-server's functional test setup and the cabal v2-repl invocation, but does not name Cabal source files or tests. Start by comparing the captured command and failure with runs under each GHCup-selected Cabal version, then inspect how Cabal selects packages for the REPL. Done means switching between 3.18.1.0 and 3.18.2.0 no longer leaves the reported command failing.

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

Descrizione

needs triage type: bug

Describe the bug

Switching between Cabal 3.18.1.0 and 3.18.2.0 seems to break one or the other. With the error copied below.

Foreword to the reproduction steps

  • I'm perfectly open to be proved wrong in reporting this bug, if the bug is indeed on my end's configuration, rather than on the Cabal tool; in this sense, please, do ask me for more logs, experiments, and so on, if that can help the investigation.

  • Following the steps below does not require using the Haskell Language Server, but just cloning its repository and using it as the project on which Cabal is to be used. Despite I haven't been able to reproduce the issue on a smaller, more "hello world"-y project, I think that HLS codebase is just incidental, and necessary only to the extent that it is non-toy enough for the Cabal erroneous behavior to emerge.

  • More crucial, possibly, is the coupling with GHCup, in the sense that the reproduction steps build on the fact that ghcup set cabal x.y.z; cmd do different things ghcup run --cabal x.y.z -- cmd; I'm not sure what's the expected difference, but in any case Julian claims the tool is simple enough, and that it's doing the right thing, according to the information I've provided to him (see https://codeberg.org/haskell/ghcup-hs/issues/1410, but I might hunt down some older conversation in the Element chat, if you want).

  • You'll see I prepend commands that end up building stuff with ionice nice. This should be entirely irrelevant to the issue; as far as I understand, I'm just doing that to prevent GHC's from hogging my RAM and therefore making my system unresponsive, possibly causing the OOM killer to take down the whole tmux session I'm working in (yes, it happened ot me serveral times).

To Reproduce

  1. Clone HLS and checkout its current origin/master, which is https://github.com/haskell/haskell-language-server/commit/95eb9af94282fd2244a3c4679072b8a7e8e22c97 at the time of writing;
    • git diff shows no output;
    • I'm starting from the assumption that step 2 and 3 below pass;
  2. run ghcup set cabal 3.18.2.0 or do the equivalent via GHCup;
  3. run haskell-language-server-9.14.1~2.15.0.0 --debug test/functional/Format.hs, which succeeds;
  4. run ghcup set cabal 3.18.1.0 or do the equivalent via GHCup;
  5. repeat step 3, which now fails;
    Hidden:   no
    Range:    1:1-2:1
    Source:   cradle
    Severity: DiagnosticSeverity_Error
    Code:     <none>
    Message:
      Failed to run cabal
      '--builddir=/home/enrico/.cache/hie-bios/dist-haskell-language-server-16967e34052bfb51b0fe980f04bae501'
      v2-repl --with-repl /home/enrico/.cache/hie-bios/repl-wrapper-fae20739a232ed1b9dcdf40eca9cf71e
      --enable-multi-repl --keep-temp-files
      /home/enrico/haskell-language-server/test/functional/Format.hs in directory
      "/home/enrico/haskell-language-server". Consult the logs for full command and error.
      Failed command: cabal
      '--builddir=/home/enrico/.cache/hie-bios/dist-haskell-language-server-16967e34052bfb51b0fe980f04bae501'
      v2-repl --with-repl /home/enrico/.cache/hie-bios/repl-wrapper-fae20739a232ed1b9dcdf40eca9cf71e
      --enable-multi-repl --keep-temp-files
      /home/enrico/haskell-language-server/test/functional/Format.hs
      Build profile: -w ghc-9.14.1 -O1
      In order, the following will be built (use -v for more details):
      - haskell-language-server-2.15.0.0 (interactive) (test:func-test) (first run)
      [1 of 2] Compiling Main (
      /home/enrico/.cache/hie-bios/dist-haskell-language-server-16967e34052bfb51b0fe980f04bae501/build/x86_64-linux/ghc-9.14.1/haskell-language-server-2.15.0.0/t/func-test/setup/setup.hs,
      /home/enrico/.cache/hie-bios/dist-haskell-language-server-16967e34052bfb51b0fe980f04bae501/build/x86_64-linux/ghc-9.14.1/haskell-language-server-2.15.0.0/t/func-test/setup/Main.o
      )
    
      /home/enrico/.cache/hie-bios/dist-haskell-language-server-16967e34052bfb51b0fe980f04bae501/build/x86_64-linux/ghc-9.14.1/haskell-language-server-2.15.0.0/t/func-test/setup/setup.hs:2:1:
      error: [GHC-87110]
      Could not load module ‘Distribution.Simple’.
      It is a member of the hidden package ‘Cabal-3.19.0.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      It is a member of the hidden package ‘Cabal-3.19.0.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      It is a member of the hidden package ‘Cabal-3.16.1.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      It is a member of the hidden package ‘Cabal-3.16.1.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      It is a member of the hidden package ‘Cabal-3.16.0.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      It is a member of the hidden package ‘Cabal-3.12.1.0’.
      Perhaps you need to add ‘Cabal’ to the build-depends in your .cabal file.
      |
      2 | import Distribution.Simple; main = defaultMain
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    
      Error: [Cabal-7125]
      repl failed for test:func-test from haskell-language-server-2.15.0.0.
    
  6. run ghcup run --cabal 3.18.1.0 -- copy command from step 3, verbatim, which succeeds;
    • some building happened;
  7. repeat step 3, which succeeds;
    • the output looks a lot like step 6's, i.e. some building happened;
  8. repeat step 3 once more, which obviously succeeds;
    • the output is much shorter, i.e. no further building happened;
  9. run ghcup set cabal 3.18.2.0 or do the equivalent via GHCup;
  10. repeat step 3, which now fails;
  11. run ghcup run --cabal 3.18.2.0 -- copy command from step 3, verbatim, which succeeds;
    • some building happened;
  12. repeat step 3, which succeeds;
    • the output looks a lot like step 6's, i.e. some building happened;
  13. repeat step 3 once more, which obviously succeeds;
    • the output is much shorter, i.e. no further building happened;

Notice that:

  • steps from 4 to 13 are a round trip;
  • steps from 4 to 8 are identical to those from 9 to 13, except that 3.18.1.0 and 3.18.2.0 are swapped around.

At https://paste.c-net.org/RiggsHijacked is the whole content of my terminal window after I've gone through all the steps described above. Indeed, you'll see 12 occurrences of my shell's prompt (it contains a snail emoji: 🐌), which are corresponding precisely to the steps from 2 to 13.

Expected behavior

Whatever Cabal version I select via GHCup, the following time I exercise the code via step 3 above should compile (and afterwards run) successfully.

System information

  • up-to-date ArchLinux,
  • HLS version (2.15.0.0) and the GHC version (9.14.1) it works with are locked by calling the specific executable, as shown in the reproduction steps.

Additional context

I initially reported the issue at https://github.com/haskell/haskell-language-server/issues/5155, but when I realized the GHCup dance necessary to demonstrate the whole weird behavior, I opened an issue on https://codeberg.org/haskell/ghcup-hs/issues/1410. In both those threads you might find relevant comments from respective maintainers.

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.