Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
abhin4v opened this issue Sep 13, 2021 · 3 comments · Fixed by #7847

Comments

@abhin4v
Copy link

abhin4v commented Sep 13, 2021

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
@Mikolaj
Copy link
Member

Mikolaj commented Sep 13, 2021

[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?

@Mikolaj
Copy link
Member

Mikolaj commented Sep 13, 2021

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

@Mikolaj
Copy link
Member

Mikolaj commented Sep 13, 2021

The broken code is from 13 months ago.

dhmnr added a commit to dhmnr/cabal that referenced this issue Dec 1, 2021
This fixes the crash when `post-checkout-command` option for
`source-repository-package` returns an exit status 0.
byorgey pushed a commit to dhmnr/cabal that referenced this issue Dec 29, 2021
This fixes the crash when `post-checkout-command` option for
`source-repository-package` returns an exit status 0.
@mergify mergify bot closed this as completed in #7847 Dec 29, 2021
mergify bot added a commit that referenced this issue Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants