Repository navigation
Open
Labels
Description
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?
cabal/cabal-testsuite/src/Test/Cabal/Prelude.hs
Lines 397 to 415 in 07e003b
| | cmd `elem` ["v2-sdist", "path"] = | |
| ["--project-file=" ++ fp | Just fp <- [testCabalProjectFile env]] | |
| | cmd == "v2-clean" || cmd == "clean" = | |
| ["--builddir", testDistDir env] | |
| ++ ["--project-file=" ++ fp | Just fp <- [testCabalProjectFile env]] | |
| | "v2-" `isPrefixOf` cmd = | |
| [ "--builddir" | |
| , testDistDir env | |
| , "-j1" | |
| ] | |
| ++ ["--project-file=" ++ fp | Just fp <- [testCabalProjectFile env]] | |
| ++ ["--package-db=" ++ db | Just dbs <- [testPackageDbPath env], db <- dbs] | |
| | "v1-" `isPrefixOf` cmd = | |
| ["--builddir", testDistDir env] | |
| ++ install_args | |
| | otherwise = | |
| ["--builddir", testDistDir env] | |
| ++ ["--package-db=" ++ db | Just dbs <- [testPackageDbPath env], db <- dbs] | |
| ++ install_args |
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.
Activity
philderbeast commentedon Oct 31, 2026
In #12502 I've marked those that fail this way with
expectBroken 12501.