Skip to content

add --full-version and compiler info#11339

Merged
mergify[bot] merged 1 commit intohaskell:masterfrom
geekosaur:more-version-info
Mar 11, 2026
Merged

add --full-version and compiler info#11339
mergify[bot] merged 1 commit intohaskell:masterfrom
geekosaur:more-version-info

Conversation

@geekosaur
Copy link
Collaborator

@geekosaur geekosaur commented Dec 11, 2025

I'm not sure if this counts as a significant change or not, since it's a new out-of-the-way command line option

hilfy «cabal+more-version-info¤@a11e10471» Z$ $(cabal list-bin cabal) --full-version
Warning: this is a debug build of cabal-install with assertions enabled.
cabal-install version 3.17.0.0 (commit 475bba6 on more-version-info, Wed Jan 21 01:42:37 2026 +0000)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
with ghc 9.10.3 on linux x86_64

The information added by this change is the last line. If a development GHC version is used to build cabal, the version will include a datestamp (e.g. 9.14.0.20251128).

The original output of --version has been restored; all new information now lives under --full-version.

The reason for this is a perplexing cabal bug report on the FP Discord that turned out to be the user running a Linux build of cabal on FreeBSD. Cabal tends to trust System.Info for local system information for some things, but it's hardcoded to the system cabal was built on, not the one it's running on. (I think this can only arise on FreeBSD, although presumably a lesser form might happen on older Apple Silicon Macs running an Intel build via Rosetta2.)

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:


QA notes:

  • Verify that --version is back to what it was before any of the git revision changes, including spaces
  • Verify that --full-version includes git information (if supported) and compiler information
  • Verify that cabal exec cabal -- act-as-setup -- --full-version includes git (if available) and compiler information
  • If you're in a position to install the new Cabal library and have a Setup.hs sitting around, verify that runhaskell Setup.hs -- --full-version works and includes them
    • I'm not sure this is actually doable; can you force it to use a different Cabal than comes with the current ghc?
  • If you happen to have a FreeBSD system, verify that
    • a native FreeBSD build has the correct information
    • a Linux build via the Linuxulator (if you have it configured) shows Linux information

@geekosaur
Copy link
Collaborator Author

This is a proposed change, and open to review and suggestions.

Mikolaj
Mikolaj previously approved these changes Dec 12, 2025
Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Dec 12, 2025

Can you show how it'll look like in the description? Also, it'd be good to add some motivation. Remember that by default we expect a ticket before a PR.

@geekosaur
Copy link
Collaborator Author

geekosaur commented Dec 12, 2025

The motivation was trying to get that information from someone on Discord who was having odd problems with cabal, and IIRC it turned out they were using a cross-built cabal.


ETA: misremembered; they were using a Linux-built cabal on FreeBSD. As most OSes don't have built-in Linux emulators, this won't be common; the closest you'd get is Apple's Rosetta(2), which at least has the OS right.

I don't consider this final by any means; some programs have a ---full-version or --version-full option, for example, which includes this kind of information (and the GIT_REV stuff might also move there if we add it).


ETA: The reason for both variants is that the former makes more semantic sense, but the latter is a faster shell command line edit to get the additional information if you forget to use it the first time.

@geekosaur geekosaur force-pushed the more-version-info branch 2 times, most recently from 916c671 to aa47f49 Compare December 12, 2025 23:02
@geekosaur
Copy link
Collaborator Author

I moved that #if to a new Distribution.Client.Compat.SysInfo module.

@geekosaur geekosaur force-pushed the more-version-info branch 2 times, most recently from 12ecf00 to e9c66f5 Compare December 13, 2025 01:49
ulysses4ever
ulysses4ever previously approved these changes Dec 18, 2025
@geekosaur geekosaur force-pushed the more-version-info branch 2 times, most recently from eeda6ef to 475bba6 Compare January 21, 2026 01:41
@geekosaur
Copy link
Collaborator Author

Updated the title and description to reflect the new implementation.

@geekosaur geekosaur changed the title add compiler info to --version add --version-full and compiler info Jan 21, 2026
@geekosaur geekosaur marked this pull request as ready for review January 21, 2026 02:22
@geekosaur
Copy link
Collaborator Author

Re-requesting reviews because adding a new option makes it a bit more invasive code-wise.

@geekosaur geekosaur dismissed stale reviews from ulysses4ever and Mikolaj January 21, 2026 04:02

new code needs re-review

@geekosaur
Copy link
Collaborator Author

It just occurred to me: should the Cabal library get a similar change for Setup.hs's (Distribution.Simple, I presume?) CLI?

@geekosaur
Copy link
Collaborator Author

geekosaur commented Mar 7, 2026

"in-tree" literally means that cabalGitInfo and cabalInstallGitInfo match. I think, in the absence of some weird git hackery, this can only happen if cabal-install is built from a git checkout which will build and use the Cabal that comes with it (would need project file surgery to change that).

I think the one you got by running cabal directly would be the one from ghcup, per your type command. It supports neither variant of this option; the first version of the extended version information patch is in there, but (a) is appended to --version (b) isn't present in release builds (compare cabal.release.project to cabal.validate.project). This is confirmed by the stray " (in-tree)" with no corresponding cabal-install information, which was a bug in the first version (along with an extra space after the basic cabal-install version which accidentally got lost in the rewrite).

@philderbeast
Copy link
Collaborator

I think the one you got by running cabal directly would be the one from ghcup

Yes that is so for the first one. Not so for the second one. I've added headings to make that clearer.

@geekosaur
Copy link
Collaborator Author

Hm. How did you build that? It sorta looks like the problem I hit early on with #11372 (which was the flag setting being missing from one of the project files), but reversed.

@philderbeast
Copy link
Collaborator

philderbeast commented Mar 7, 2026

Hm. How did you build that?

$ git rev-parse HEAD
4e1d389dabcce4a81313b2fa1194128bbbca2c62

$ cabal clean

$ cabal install cabal-install:exe:cabal --overwrite-policy=always --install-method=copy
...
Resolving dependencies...
Build profile: -w ghc-9.14.1 -O1
In order, the following will be built (use -v for more details):
 - process-1.6.26.2 (lib) (requires build)
 - open-browser-0.4.0.0 (lib) (requires build)
 - hsc2hs-0.68.10 (exe:hsc2hs) (requires build)
 - githash-0.1.7.0 (lib) (requires build)
 - echo-0.1.4 (lib) (requires build)
 - zlib-0.7.1.1 (lib) (requires build)
 - network-3.2.8.0 (lib) (requires build)
 - Cabal-3.17.0.0 (lib) (requires build)
 - hackage-security-0.6.3.2 (lib) (requires build)
 - HTTP-4000.5.0 (lib) (requires build)
 - cabal-install-solver-3.17.0.0 (lib) (requires build)
 - cabal-install-3.17.0.0 (lib) (requires build)
 - cabal-install-3.17.0.0 (exe:cabal) (requires build)
Starting     process-1.6.26.2 (lib)
Building     process-1.6.26.2 (lib)
Installing   process-1.6.26.2 (lib)
Completed    process-1.6.26.2 (lib)
Starting     open-browser-0.4.0.0 (lib)
Starting     echo-0.1.4 (lib)
Starting     githash-0.1.7.0 (lib)
Starting     hsc2hs-0.68.10 (exe:hsc2hs)
Building     open-browser-0.4.0.0 (lib)
Building     echo-0.1.4 (lib)
Building     githash-0.1.7.0 (lib)
Building     hsc2hs-0.68.10 (exe:hsc2hs)
Installing   open-browser-0.4.0.0 (lib)
Installing   echo-0.1.4 (lib)
Installing   githash-0.1.7.0 (lib)
Completed    open-browser-0.4.0.0 (lib)
Completed    echo-0.1.4 (lib)
Completed    githash-0.1.7.0 (lib)
Starting     Cabal-3.17.0.0 (lib)
Building     Cabal-3.17.0.0 (lib)
Installing   hsc2hs-0.68.10 (exe:hsc2hs)
Completed    hsc2hs-0.68.10 (exe:hsc2hs)
Starting     zlib-0.7.1.1 (lib)
Starting     network-3.2.8.0 (lib)
Building     zlib-0.7.1.1 (lib)
Building     network-3.2.8.0 (lib)
Installing   zlib-0.7.1.1 (lib)
Completed    zlib-0.7.1.1 (lib)
Installing   network-3.2.8.0 (lib)
Completed    network-3.2.8.0 (lib)
Starting     HTTP-4000.5.0 (lib)
Starting     hackage-security-0.6.3.2 (lib)
Building     HTTP-4000.5.0 (lib)
Building     hackage-security-0.6.3.2 (lib)
Installing   HTTP-4000.5.0 (lib)
Completed    HTTP-4000.5.0 (lib)
Installing   hackage-security-0.6.3.2 (lib)
Completed    hackage-security-0.6.3.2 (lib)
Installing   Cabal-3.17.0.0 (lib)
Completed    Cabal-3.17.0.0 (lib)
Starting     cabal-install-solver-3.17.0.0 (lib)
Building     cabal-install-solver-3.17.0.0 (lib)
Installing   cabal-install-solver-3.17.0.0 (lib)
Completed    cabal-install-solver-3.17.0.0 (lib)
Starting     cabal-install-3.17.0.0 (lib)
Building     cabal-install-3.17.0.0 (lib)
Installing   cabal-install-3.17.0.0 (lib)
Completed    cabal-install-3.17.0.0 (lib)
Starting     cabal-install-3.17.0.0 (exe:cabal)
Building     cabal-install-3.17.0.0 (exe:cabal)
Installing   cabal-install-3.17.0.0 (exe:cabal)
Completed    cabal-install-3.17.0.0 (exe:cabal)
Copying 'cabal' to '/home/.../.local/bin/cabal'

$ cabal --full-version
cabal-install version 3.17.0.0
compiled using version 3.17.0.0 of the Cabal library 
with ghc 9.14.1 on linux x86_64

$ type cabal
cabal is /home/.../.local/bin/cabal
$ cabal run cabal -- --full-version
Warning: this is a debug build of cabal-install with assertions enabled.
cabal-install version 3.17.0.0 (commit 4e1d389 on more-version-info, Fri Mar 6 21:28:55 2026 -0500)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
with ghc 9.14.1 on linux x86_64

@geekosaur
Copy link
Collaborator Author

You're getting a different version of cabal from somewhere, I think: note the absence of the Warning line the second one has.

@philderbeast
Copy link
Collaborator

It sorta looks like the problem I hit early on with #11372 (which was the flag setting being missing from one of the project files), but reversed.

The project flags look good:

$ cat cabal.project
import: project-cabal/ghc-options.config
import: project-cabal/ghc-latest.config
import: project-cabal/pkgs.config
import: project-cabal/constraints.config

tests: True

-- if you are developing on a system without TH, use a `cabal.project.local`
-- to disable this
package cabal-install
  flags: +git-rev

package Cabal
  flags: +git-rev

@philderbeast
Copy link
Collaborator

philderbeast commented Mar 7, 2026

You're getting a different version of cabal from somewhere

Could be and now I don't trust cabal install 😢

$ ./dist-newstyle/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal --full-version
cabal-install version 3.17.0.0 (commit 4e1d389 on more-version-info, Fri Mar 6 21:28:55 2026 -0500)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
with ghc 9.14.1 on linux x86_64

@geekosaur
Copy link
Collaborator Author

Oh, hm, I think the warning actually comes from the outer run (cabal run) and we don't reach it if only doing one of the version options.

Confirmed:

hilfy «cabal+more-version-info» Z$ x=$(cabal list-bin cabal)
Warning: this is a debug build of cabal-install with assertions enabled.
hilfy «cabal+more-version-info» Z$ $x --full-version
cabal-install version 3.17.0.0 (commit 4e1d389 on more-version-info, Fri Mar 6 21:28:55 2026 -0500)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
with ghc 9.10.3 on linux x86_64
hilfy «cabal+more-version-info» Z$ 

Which still leaves why you didn't get full output. I wonder if blowing away dist-newstyle instead of using cabal clean affects it. (I have a vague recollection of cabal clean not always being complete, although I don't see any issues for it; I always just nuke dist-newstyle.)

@philderbeast
Copy link
Collaborator

philderbeast commented Mar 7, 2026

I deleted dist-newstyle, ran cabal install, noted that the installed --full-version problem persists, saw there was no cabal build artifact in the location I'd ran it from so I ran cabal build and then ran cabal install so that the installed and built versions were side-by-side. They give different outputs for --full-version. The built one is named cabal the installed one is named cabal-check.

$ cabal install cabal-install:exe:cabal \
  --overwrite-policy=always \
  --install-method=copy \
  --program-suffix=-check \
  --installdir=./dist-new style/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal
...
Copying 'cabal' to
'./dist-newstyle/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal-check'

# from cabal build
$ ./dist-newstyle/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal --full-version
cabal-install version 3.17.0.0 (commit 4e1d389 on more-version-info, Fri Mar 6 21:28:55 2026 -0500)
compiled using version 3.17.0.0 of the Cabal library (in-tree)
with ghc 9.14.1 on linux x86_64

# from cabal install
$ ./dist-newstyle/build/x86_64-linux/ghc-9.14.1/cabal-install-3.17.0.0/x/cabal/build/cabal/cabal-check --full-version
cabal-install version 3.17.0.0
compiled using version 3.17.0.0 of the Cabal library 
with ghc 9.14.1 on linux x86_64

@geekosaur
Copy link
Collaborator Author

Uh, I think this might be #6472.

@geekosaur geekosaur added merge me Tell Mergify Bot to merge and removed attention: needs-review labels Mar 7, 2026
@mergify mergify bot added ready and waiting Mergify is waiting out the cooldown period merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days queued labels Mar 7, 2026
@mergify
Copy link
Contributor

mergify bot commented Mar 9, 2026

Merge Queue Status

This pull request spent 13 minutes 43 seconds in the queue, including 3 minutes 11 seconds running CI.

Required conditions to merge
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
    • check-success = Doctest Cabal
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Meta checks
    • check-skipped = Meta checks
    • check-success = Meta checks
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Validate post job
    • check-skipped = Validate post job
    • check-success = Validate post job
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
    • check-success = Bootstrap post job
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of [🛡 GitHub branch protection]:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of [🛡 GitHub branch protection]:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of [🛡 GitHub branch protection]:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of [🛡 GitHub branch protection]:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

Reason

The merge conditions cannot be satisfied due to failing checks

Failing checks:

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

mergify bot added a commit that referenced this pull request Mar 9, 2026
@mergify mergify bot added dequeued and removed queued labels Mar 9, 2026
@geekosaur
Copy link
Collaborator Author

@Mergifyio queue

@mergify
Copy link
Contributor

mergify bot commented Mar 11, 2026

Merge Queue Status

This pull request spent 2 hours 13 minutes 3 seconds in the queue, including 2 hours 2 minutes 26 seconds running CI.

Required conditions to merge
  • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Doctest Cabal
    • check-neutral = Doctest Cabal
    • check-skipped = Doctest Cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Meta checks
    • check-neutral = Meta checks
    • check-skipped = Meta checks
  • any of [🛡 GitHub branch protection]:
    • check-success = docs/readthedocs.org:cabal
    • check-neutral = docs/readthedocs.org:cabal
    • check-skipped = docs/readthedocs.org:cabal
  • any of [🛡 GitHub branch protection]:
    • check-success = Validate post job
    • check-neutral = Validate post job
    • check-skipped = Validate post job
  • any of [🛡 GitHub branch protection]:
    • check-success = fourmolu
    • check-neutral = fourmolu
    • check-skipped = fourmolu
  • any of [🛡 GitHub branch protection]:
    • check-success = hlint
    • check-neutral = hlint
    • check-skipped = hlint
  • any of [🛡 GitHub branch protection]:
    • check-success = Bootstrap post job
    • check-neutral = Bootstrap post job
    • check-skipped = Bootstrap post job
  • any of [🛡 GitHub branch protection]:
    • check-success = whitespace
    • check-neutral = whitespace
    • check-skipped = whitespace
  • any of [🛡 GitHub branch protection]:
    • check-success = Check sdist post job
    • check-neutral = Check sdist post job
    • check-skipped = Check sdist post job
  • any of [🛡 GitHub branch protection]:
    • check-success = Changelogs
    • check-neutral = Changelogs
    • check-skipped = Changelogs

@mergify mergify bot added queued and removed dequeued labels Mar 11, 2026
mergify bot added a commit that referenced this pull request Mar 11, 2026
@mergify mergify bot merged commit 96e668a into haskell:master Mar 11, 2026
277 of 278 checks passed
@github-project-automation github-project-automation bot moved this from Testing to To Test in Manual QA board Mar 11, 2026
@mergify mergify bot removed the queued label Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge ready and waiting Mergify is waiting out the cooldown period

Projects

Status: To Test

Development

Successfully merging this pull request may close these issues.

7 participants