cabal-testsuite bare versus v2-prefixed command handling

Aperta
#12,501 1 commento 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
Mezza giornata
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
haskell
Ambito
testing, tooling

Direzione di ricerca

Start by reading cabal-testsuite/src/Test/Cabal/Prelude.hs around the linked cabalGArgs code, then run the provided PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs reproduction. Check how the test helper recognizes Cabal commands and aliases. Done means the test can use sdist and behaves like v2-sdist, with the expected output and location.

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

Descrizione

needs triage type: bug

Describe the bug
I used sdist in a cabal-testsuite test in #12499 and it failed the validate step. Changing this to v2-dist fixed the test failure but v2-sdist is a synonym for sdist, isn't it?

$ cabal --help

[sanity checks and shipping]
...
  sdist                  Generate a source distribution file (.tar.gz).
...
[new-style projects (forwards-compatible aliases)]
...
  v2-sdist               Generate a source distribution file (.tar.gz).

 [legacy command aliases]
  v1-build               Compile all/specific components.
  v1-configure           Prepare to build the package.
  v1-repl                Open an interpreter session for the given component.
  v1-run                 Builds and runs an executable.
  v1-test                Run all/specific tests in the test suite.
  v1-bench               Run all/specific benchmarks.
  v1-freeze              Freeze dependencies.
  v1-haddock             Generate Haddock HTML documentation.
  v1-install             Install packages.
  v1-clean               Clean up after a build.
  v1-copy                Copy the files of all/specific components to install locations.
  v1-register            Register this package with the compiler.
  v1-reconfigure         Reconfigure the package if necessary.
  v1-gen-bounds          Generate dependency bounds.

Note there is no v1-sdist included with the help.

Perhaps the command matching in cabalGArgs is out of step with cabal's commands and command aliases?

https://github.com/haskell/cabal/blob/07e003b333424d6557a3ffd396895e5147eeb6d8/cabal-testsuite/src/Test/Cabal/Prelude.hs#L397-L415

To Reproduce
On master from the root:

cabal build cabal-install:exe:cabal cabal-testsuite:cabal-tests
CABAL=$(cabal list-bin cabal-install:exe:cabal)
TESTS=$(cabal list-bin cabal-testsuite:cabal-tests)
cd cabal-testsuite
$TESTS --with-cabal=$CABAL --intree-cabal-lib=$PWD/.. \
  --test-tmp=/tmp/cabal-testdb \
  PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs
...
Error: cabal: unrecognized 'sdist' option
`--package-db=/tmp/cabal-testdb/intree/store/ghc-9.14.1-c6c3/package.db'

Now change the test:

--- a/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs
+++ b/cabal-testsuite/PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs
-    cabal "sdist" ["all"]
+    cabal "v2-sdist" ["all"]

The test has different output when run again with this diff:

CABAL=$(cabal list-bin cabal-install:exe:cabal)
TESTS=$(cabal list-bin cabal-testsuite:cabal-tests)
cd cabal-testsuite
$TESTS --with-cabal=$CABAL --intree-cabal-lib=$PWD/.. \
  --test-tmp=/tmp/cabal-testdb \
  PackageTests/SDist/Respect-Project-File/cabal.no-project.test.hs
...
# STDERR:
--- /tmp/cabal-testsuite-3454100/cabal.no-project.dist/cabal.no-project.out.normalized	2026-10-30 12:09:13.663990497 -0400
+++ /tmp/cabal-testsuite-3454100/cabal.no-project.dist/cabal.no-project.comp.out.normalized	2026-10-30 12:09:13.663929684 -0400
@@ -1,2 +1,2 @@
-# cabal sdist
-Wrote tarball sdist to <ROOT>/cabal.no-project.dist/work/./dist/sdist/p-0.1.tar.gz
+# cabal v2-sdist
+Wrote tarball sdist to <ROOT>/dist-newstyle/sdist/p-0.1.tar.gz
cabal.no-project.test.hs: Uncaught exception ghc-internal:GHC.Internal.Exception.ErrorCall:

FAIL
...

Expected behavior
That I can use the current command vocabulary in tests. In this case that I can usesdist for a test and that behaves the same as if I'd used v2-sdist.

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.