haskell/cabal

Successful execution of post-checkout-command for source-repository-package option causes cabal to crash

abhin4v opened this issue · 3 comments

Describe the bug
post-checkout-command option for source-repository-package option in the cabal.project file causes cabal to crash when the post-checkout-command returns exit status 0. The correct behaviour should be to not crash and keep building.

To Reproduce
Create a new cabal project with a cabal.project file with a post-checkout-command. Here's I'm using hpack:

with-compiler: ghc-9.0.1

packages:
    ./

source-repository-package
  type: git
  location: https://github.com/berberman/mustache
  tag: 9d28fe2aa6578b15efcc4d00fdf97f015007127a
  post-checkout-command: hpack

Run

$ cabal v2-build

Expected behavior
Cabal should fetch the source dependency, run the post-checkout-command (hpack), and then successfully build the project.

System information

  • mac OSX
  • cabal: 3.6.0, ghc: 9.0.1

Additional context
The failure is caused by the code here. The correct code should be

unless (exitCode == ExitSuccess) $ exitWith exitCode

[Edit: the kind reporter provided a fix and it looks reasonable, so I think we can shortcut.]

Thank you for the report. Could somebody triage? Does it happen with a different GHC? With cabal 3.4? On Linux or Windows? Could somebody reproduce?

Huh, the wrong code snippet looks like a double negation. Always problems with that. :)

The broken code is from 13 months ago.