-
Notifications
You must be signed in to change notification settings - Fork 715
Add --with-repl flag to modify program the "repl" starts with #10996
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
base: master
Are you sure you want to change the base?
Conversation
> hie-bios debug src/HIE/Bios.hs
Root directory: /home/hugin/Documents/haskell/hie-bios
Component directory: /home/hugin/Documents/haskell/hie-bios
GHC options: @/tmp/ghci84462-0.rsp
GHC library directory: CradleSuccess "/home/hugin/.ghcup/ghc/9.6.7/lib/ghc-9.6.7/lib"
GHC version: CradleSuccess "9.6.7"
Config Location: No explicit config found
Cradle: Cradle{ cradleRootDir = "/home/hugin/Documents/haskell/hie-bios", cradleOptsProg = CradleAction: Cabal}
Dependencies: hie-bios.cabal cabal.project cabal.project.local The branch passes the test-suite with the |
c037a88
to
8d7c567
Compare
cabal-testsuite/PackageTests/WithRepl/cabal.with-repl-invalid-path.out
Outdated
Show resolved
Hide resolved
I'm in the process of testing this with
What I think happened here:
@fendor please correct me if I'm wrong, but I think you are building dependencies through the wrapper script, right? This is generally not safe! What you should do instead:
HLS is currently corrupting the cabal store and I assume the average users will not have the expertise to figure out what is even going on in a situation like this. Possibly, |
@mpickering thanks a lot for working on this. I think this will make things quite more robust. |
@sol you should be an approving contributor on this repo iirc. Could you please formally approve this PR if you're happy with it? |
Same to @fendor |
@sol You should be aware that using --with-repl requires the user is using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one nitpick in the documentation
EDIT: oh I should have read the full comment, so |
@fendor Does this make sense? |
@sol I'm not sure what the bug is exactly, but it seems like a different bug which is exposed by using the hie-bios wrapper. In general, relying on the existence of a |
It makes sense! I doubt we will change that now since the wrapper is finally going to be phased out, anyway, but I understand now. |
It's not a "bug" that you could easily fix, at least not that I could think of. But you could argue that |
We already have two approvals. I can still offer to do a proper code review, but that would need to wait until tomorrow. It's late here already. |
People have been noting that |
@sol I'd appreciate if you could do a proper review at your convenience, if it's possible during this week. We still have things to do before 3.16 is finalized, so it'd only be wise to get this feature scrutinized as much as we can afford in the time we have. |
@mpickering do you plan to look into the CI failures? |
I have been looking all day, They are some bug on windows
I can't reproduce it locally and I don't know how to fix it. It seems that the test completes, but then when the folder is cleaned up the deletion fails because it thinks the executable is still being used for something. |
Oh my, classic Windows... Well, worst case we could disable these tests on Windows. |
I am going to skip the test on windows as I don't have time to investigate this to the root. |
@jasagredo Perhaps you could try and reproduce this if you had a spare moment. I have used your helpful |
8ad3ce7
to
e42c5f7
Compare
@mpickering I can give it a look, however not in the near future as I am quite busy these weeks 😢 |
No problem, just wanted to flag it up in case you were interested. |
FTR I created a label "re: --with-repl" for future issues: re: --with-repl @mpickering may be it's a good time to set the merge label so that the countdown for last two days starts? If any last-minute reviews come in in that period, any comments they will have will block merging, so we'll still have time to discuss. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpickering I'm grateful that you put in the work to solve this in a clean way.
The code looks good to me.
- There's one comment that disrupted my reading flow somehow. I left two alternative suggestions, please feel free to cherry pick whatever you think is useful.
- There's still some code duplication in the code dealing with constraints. It's not a big issue, but as
replAction
is already spanning over 270 lines of code, personally I would take every opportunity to keep things in check. - Not really excited about response files in general, but I guess they're a necessary evil for Windows/macOS. I left a comment, but no action needed.
Thanks @sol for the great review. A pleasure doing business with you. I applied the changes you suggested and now assigned to merge. |
Programs like doctest and hie-bios want to use `cabal-install` in order to discover the correct options to start a GHC session. Previously they used the `--with-compiler` option, but this led to complications since the wrapper was called for compiling all dependencies and so on, the shim had to be more complicated and forward arguments onto the user's version of GHC. The `--with-repl` command allows you to pass a program which is used instead of GHC at the final invocation of the repl. Therefore the wrappers don't have to deal with being a complete shim but can concentrate on intercepting the arguments at the end. This commit removes the special hack to not use response files with --interactive mode. Tools are expected to deal with them appropiately, which is much easier now only one invocation is passed to the wrapper. Fixes #9115
Programs like doctest and hie-bios want to use
cabal-install
in orderto discover the correct options to start a GHC session. Previously they
used the
--with-compiler
option, but this led to complications sincethe wrapper was called for compiling all dependencies and so on, the
shim had to be more complicated and forward arguments onto the user's
version of GHC.
The
--with-repl
command allows you to pass a program which is usedinstead of GHC at the final invocation of the repl. Therefore the
wrappers don't have to deal with being a complete shim but can
concentrate on intercepting the arguments at the end.
This commit removes the special hack to not use response files with
--interactive mode. Tools are expected to deal with them appropiately,
which is much easier now only one invocation is passed to the wrapper.
Fixes #9115
Template Α: This PR modifies behaviour or interface
Include the following checklist in your PR:
significance: significant
in the changelog file.