cabal icon indicating copy to clipboard operation
cabal copied to clipboard

fix some backward compatibility bugs in `GIT_REV`

Open geekosaur opened this issue 1 week ago β€’ 1 comments

It was incorrectly displaying (in-tree) when there was no git information. Also, the spacing was slightly incompatible with older versions.

This should restore 100% compatibility with older versions of cabal-install, for scripts that parse cabal --version output.


Template Ξ‘: This PR modifies behaviour or interface

Include the following checklist in your PR:

  • [x] Patches conform to the coding conventions.
  • [ ] Any changes that could be relevant to users have been recorded in the changelog.
  • [ ] The documentation has been updated, if necessary.
  • [x] Manual QA notes have been included.
  • [ ] Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

geekosaur avatar Dec 12 '25 22:12 geekosaur

QA notes:

Build cabal for release (cabal --project-file=cabal.release.project build cabal). Run the following: (assumes you have cabal-3.14.2.0 and cabal-3.16.0.0 installed via e.g. ghcup)

hilfy Z$ cabal-3.14.2.0 --version | sed 's/$/~/'
cabal-install version 3.14.2.0~
compiled using version 3.14.2.0 of the Cabal library ~
hilfy Z$ cabal-3.16.0.0 --version | sed 's/$/~/'
cabal-install version 3.16.0.0 ~
compiled using version 3.16.0.0 of the Cabal library (in-tree)~
hilfy Z$ $(cabal list-bin cabal) --version | sed 's/$/~/' 
cabal-install version 3.17.0.0~
compiled using version 3.17.0.0 of the Cabal library ~

3.14.2.0 is the original output. (I assume the extra space crept in when the Cabal library version was added.) 3.16.0.0 is the buggy output. The final one is the fixed output; it should match 3.14.2.0 aside from the reported versions, in particular in the final spaces. Note that 3.16.0.0 has both (in-tree) and an extra space at the end of the first line.

geekosaur avatar Dec 13 '25 03:12 geekosaur

Merge Queue Status

βœ… The pull request has been merged at 519432fcab8c0892f80efa46160114129c49eadd

This pull request spent 2 hours 16 minutes 30 seconds in the queue, including 2 hours 5 minutes 58 seconds running CI. The checks were run on draft #11359.

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

mergify[bot] avatar Dec 17 '25 16:12 mergify[bot]

A bit belatedly, this is WRT https://github.com/haskell/cabal/issues/11340#issuecomment-3647017147.

geekosaur avatar Dec 20 '25 01:12 geekosaur