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

Some fixes for multi component stuff #3686

Merged
merged 3 commits into from
Jul 26, 2023
Merged

Some fixes for multi component stuff #3686

merged 3 commits into from
Jul 26, 2023

Conversation

wz1000
Copy link
Collaborator

@wz1000 wz1000 commented Jul 5, 2023

  1. Only bring units actually depended on into scope on 9.4+
  2. Cabal uses main as the unit id of all executable packages. This confused multi component sessions.
    Solution: include the hash of the options in the unit id when the unit id is called "main".

Fixes #3513

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

Minor comments, looks good to me!

Comment on lines 490 to 496
case unitIdString (homeUnitId_ df) of
-- cabal uses main for the unit id of all executable packages
-- This makes multi-component sessions confused about what
-- options to use for that component.
-- Solution: hash the options and use that as part of the unit id
-- This works because there won't be any dependencies on the
-- executable unit.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think haskell/cabal#8726 fixes this, right? If so, I think we should include that here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have any way of knowing what cabal version we're working with? In the future will we support MHU only with a sufficiently new cabal? If so then perhaps this needs a note saying when we can throw it away.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In the future, we will likely have support for older cabal versions as well, but it will be slightly hacky.

@michaelpj
Copy link
Collaborator

Cabal uses main as the unit id of all executable packages. This confused multi component sessions.

Is this a cabal bug? Presumably this means that e.g. a multi-repl with multiple executables will go wrong also?

@michaelpj
Copy link
Collaborator

Ah I see, Fendor says it might be fixed.

Comment on lines 490 to 496
case unitIdString (homeUnitId_ df) of
-- cabal uses main for the unit id of all executable packages
-- This makes multi-component sessions confused about what
-- options to use for that component.
-- Solution: hash the options and use that as part of the unit id
-- This works because there won't be any dependencies on the
-- executable unit.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have any way of knowing what cabal version we're working with? In the future will we support MHU only with a sufficiently new cabal? If so then perhaps this needs a note saying when we can throw it away.

@wz1000 wz1000 added the merge me Label to trigger pull request merge label Jul 24, 2023
@michaelpj
Copy link
Collaborator

Test failures seem maybe genuine?

@wz1000
Copy link
Collaborator Author

wz1000 commented Jul 25, 2023

I don't think so, different tests fail every time

@michaelpj
Copy link
Collaborator

IDK, it looks like it's almost always the simple-multi-test tests failing, which I think are the multi-component tests, so seems pretty plausible to me that this has made things worse?

@wz1000
Copy link
Collaborator Author

wz1000 commented Jul 26, 2023

Yeah, you are probably right, I see consistent failures in the 9.4+ jobs, I was looking at the <=9.2 jobs and saw random failures earlier. I will investigate.

…fused multi component sessions.

Solution: include the hash of the options in the unit id when the unit id is called "main".

Fixes #3513
@wz1000
Copy link
Collaborator Author

wz1000 commented Jul 26, 2023

Turned out to be a missing fallthrough case that snuck in while cherry picking the commit 🤦

@georgefst
Copy link
Collaborator

I've had my eye on this PR for a while since #3513 has been really annoying me, and for the record, it now works perfectly for my projects, where previous iterations before today would hang at initialisation. Thanks for the fix!

@wz1000 wz1000 requested a review from July541 as a code owner July 26, 2023 09:53
@mergify mergify bot merged commit 47cf162 into master Jul 26, 2023
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect flags when loading multiple executable components on GHC 9.4
4 participants