-
Notifications
You must be signed in to change notification settings - Fork 698
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
Add a warning when an env file is created #9705
Conversation
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.
Thank you so much.
++ envFile | ||
++ "\n" | ||
++ "The presence of such an environment file has several knock-on effects. Because\n" | ||
++ "changes the default package set in ghc and ghci from their default (which is\n" |
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.
"It changes"? To help distracted readers, I'd twist this sentence around and start with "tools confused" and then explain why confused. I'm wondering how to improve this further. Is the confusion one of the knock-on effects? Or is it a consequence of the effects?
++ "\n" | ||
++ "Double-check that creating a global GHC environment file is really what you\n" | ||
++ "wanted! You can also limit the effects by creating a GHC environment file in a\n" | ||
++ "specific directory only using the --package-env flag, for example:\n" |
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.
I'm afraid, sometimes it parses with "(only using)" instead of "(directory only)".
I'd also omit the warning if --package-env is used |
37aaaec
to
75f72a6
Compare
Thanks @Mikolaj and @fgaz! Very good suggestions, my PR was a bit premature perhaps. I rebased the branch on the latest master, improved the warning message text, and added a check to only show the message if There is still this issue I found when testing this, but it feels unrelated. How do you suggest I test this? A test should be self-contained so it cannot try to put a GHC environment file in the global environment, but making it local with |
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/packages.html#package-environments suggests you can put the env file in the current directory (e.g., the directory created for the test) and also there's |
@Mikolaj The point is that I'd like to test that cabal gives the warning at the appropriate time, i.e. when creating a new environment file without |
I see: you are interested in writing the file, not reading it. And it seems I wonder how disastrous setting |
Tbh I'd probably skip the test. It doesn't seem worth it |
I think the PR is ready, albeit without test. Good suggestions for a testing approach are welcome; merging as-is is also fine. |
@mergify rebase |
✅ Branch has been successfully rebased |
35b7a0b
to
0a4da41
Compare
✅ Branch has been successfully rebased |
0a4da41
to
ed20c42
Compare
I have tested this PR again when rebased to current |
Great, it's going to merge in 2 days: https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#github-pull-request-conventions. |
@mergify unqueue |
☑️ The pull request is not queued |
@mergify queue |
🛑 The pull request has been removed from the queue
|
Somehow the branch is not modifiable by mergify. I'm going to merge manually, since the delay has passed. |
@mergify rebase |
✅ Branch has been successfully rebased |
ed20c42
to
14ca1bd
Compare
@mergify rebase |
✅ Nothing to do for rebase action |
Huh, mergify merged automatically in the end after the CI finished after a |
@mergify backport 3.12 |
✅ Backports have been created
|
* Add a warning when an env file is created #6481 (comment) * Formatting * Improve wording of warning message * Only show warning if --package-env not given * Improve message and its formatting * Formatting (cherry picked from commit 00ce024)
* Add a warning when an env file is created haskell#6481 (comment) * Formatting * Improve wording of warning message * Only show warning if --package-env not given * Improve message and its formatting * Formatting
* Add a warning when an env file is created #6481 (comment) * Formatting * Improve wording of warning message * Only show warning if --package-env not given * Improve message and its formatting * Formatting (cherry picked from commit 00ce024)
Add a warning when an env file is created (backport #9705)
Inspired by #6481 (comment)
I get that there are many colourable panels on the bikeshed that is
cabal env
, and even many real engineering choices and challenges, but it would be very nice if at least the user gets some warning if theycabal install --lib
and that creates an environment file. After all, statistically, this is not what they intended, or if it was they probably didn't know the consequences. Had they known the consequences, they would have realised that this is not what they wanted.This patch only shows a warning if an environment file does not yet exist, to acknowledge the set of people who are actually using this functionality.
This is blocked on the bug mentioned here: #9697 (comment)