-
Notifications
You must be signed in to change notification settings - Fork 710
cabal run +RTS warning #8709
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
cabal run +RTS warning #8709
Conversation
I added a test in I am also currently having trouble getting the |
The test location and the very test look fine to me at a quick glance. I assume you read https://github.com/haskell/cabal/blob/master/cabal-testsuite/README.md? In my bash history I see
and in general the path to cabal binary that you give is the binary with your fixes that you just compiled. You can obtain its path with |
I read the README, just couldn't figure out the right paths, turns out something wasn't added to my path properly. I'm now able to run that test locally. |
I added a warning within |
It seems like all the tests pass (except whitespace) with the new warning. Perhaps the helper function I created should go into the |
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.
Great job! Could you add a tiny changelog file, as well (see https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog)?
Yes, I guess the helper fits one of the Utils files.
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.
@Mikolaj you also suggested the same warning could be added to cabal test
and cabal bench
. I think it would not be very hard to abstract this warning into a function and use it in multiple places. Is that still something you would like to see?
Yeah I agree with what @noughtmare says, if it is desirable for the same warning to appear with other commands, it should be no big issue to abstract this so that it can be reused. |
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 for adding the changelog file. So what are your plans? Generalize (slightly?) already in this PR or somehow mark this as future work (e.g., open a ticket about it)?
If there's a consensus on which commands should have this error I could generalise it here? Otherwise I can push this PR as it is and create a different issue with the suggestion that other commands might want a similar error. Maybe the second approach is clearer? |
I think doing it right here for |
Note that for |
Well spotted. For tests it's |
We would still like to give a warning for |
Sounds good. |
Now the warning will be given when something like |
@@ -96,6 +101,10 @@ benchAction flags@NixStyleFlags {..} targetStrings globalFlags = do | |||
++ "You may wish to use 'build --only-dependencies' and then " | |||
++ "use 'bench'." | |||
|
|||
fullArgs <- getFullArgs | |||
when (occursOnlyOrBefore fullArgs "+RTS" "--") $ |
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 probably misunderstanding, but does it search for a standalone "--" in a cabal bench
commandline? IIRC, "--" is completely ignored by bench
and test
, so that wouldn't make sense, would it?
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.
Yeah that was why I was wondering in exactly which case we want to give this warning for bench
and test
. The occursOnlyOrBefore
function worked nicely for run
as you have either +RTS ... --
(wrong) or -- ... +RTS
(right). With bench
and test
, do we want to give a warning simply when +RTS
occurs as a standalone argument, like cabal test +RTS
? Then this works, but I could also just make it elem
.
It is more difficult to check whether something like --test-options="+RTS"
is passed, because it is treated as one argument, so you can't match the string easily. So perhaps for bench
and test
the best thing is just to check if there is a standalone +RTS
. There is the edge case that a user passes something like cabal test --test-options="+RTS" +RTS ...
and actually wants to do this, then it would still give the warning even though the user is passing RTS options to the test-suite as well.
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 think using elem
would be the best. That the warning then also happens when users use cabal test --test-options="+RTS" +RTS ...
is not that bad in my opinion.
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 think warning for a standalone RTS is fine. I'd just change the warning text for test/build not to say "RTS is standalone instead of done properly", but "RTS found is standalone, which may be intentional to affect cabal, but please note RTS inside proper options is still required for RTS, if your goal is to affect the tested binary". The user may say "doh, silly computer, that's precisely why I keep the other RTS inside proper options", but I hope that's not too confusing.
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.
"Some RTS options were found standalone, which affect cabal instead of the binary. Please note RTS should be inside proper options if your goal is to affect the tested binary. For example, use 'cabal test --test-options="+RTS -N" ' to pass the '-N' RTS option to your binary."
How about this? Then the warning is still relatively succinct.
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.
Works for me. How about "Please note RTS inside proper options suffices..." to also unconfuse a user that thinks both are needed? I'm not sure how realistic such a confusion is, but one should never underestimate users. This has the extra advantage that the user doesn't get an impression that the RTS he's put inside proper options was somehow overlooked by cabal and perhaps is invisible to cabal. In other words, we pretend we see the RTS and just make sure the other RTS is not put there due to the confusion that both are needed.
I think this is ready now, only the changelog needs an update |
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.
Almost there IMHO.
++ "to pass the '-N' RTS option to your executable." | ||
giveRTSWarning "test" = "Some RTS options were found standalone, " | ||
++ "which affect cabal and not the binary. " | ||
++ "Please note that RTS inside proper options suffices " |
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'd be more specific: "+RTS inside the --test-options argument". And similarly for bench.
++ "which affect cabal and not the binary. " | ||
++ "Please note that RTS inside proper options suffices " | ||
++ "if your goal is to affect the tested binary. " | ||
++ "For example, use 'cabal test --test-options=\"+RTS -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.
For silly reasons to do with shells it's in general better to do \"cabal test --test-options=\'+RTS -N'\"
, because the user can then use double quotes inside the options (and the other way around it doesn't work).
I'm not sure why the tests are instantly failing? It seems to be something with installation, but I hardly made changes since all tests passed. |
It seems CI got broken again. I'm just rerunning in case it's transient, but it probably isn't. :| |
Yes, one test finally passes, but validation tests are borked due to infrastructure problems. It may fix itself, but if not, we'll hack around that. Apologies. |
@BasLaa thanks! In general, you don’t have to play catch-up with master — we have a merge bot for that. Currently, we only need a second review for this PR. Hopefully, it will come soon. |
@ulysses4ever good to know! |
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.
Thanks a lot @BasLaa!
Next step would be to apply a merge label. Either you or Mikolaj (if you don't have the access level necessary) will do it.
To get the future behavior now, you can configure Or you can create a dedicated github account for squash and rebase operations, and use it in different |
17c233d
to
babf2e2
Compare
Thanks for the contribution! Some merge strategy considerations: @ulysses4ever wrote:
Looks like the wrong label ("merge" instead of "squash+merge") was chosen, and we ended up with a dozen of micro-commits on External contributors might not know the best choice here, so encouraging them to set the merge label themselves can backfire. A technical solution would be to limit the "merge" label to administrators and only make the "squash+merge" label available to external contributors. I don't know if this is possible, though. Or we change our default to: reviewer/administrator sets the merge label after ok from contributor. |
Apologies, now I know for next time! |
No big problem. @andreasabel: Indeed, I learned to recommend "squash+merge_me" by default, unless I have the time to look at the number and kind of commits. I'd rather keep the current simple and inclusive setup, as much as the inability to git-bisect hurts us (I wonder if git can easily be persuaded to only consider merge commits). The extra ceremony of giving label permissions lets us honour contributors IMHO and them setting the label underscores their agency, which indeed is crucial given our lack of admins and maintainers. |
Indeed, I should have been clearer, mea culpa. I doubt you can limit which labels a contributor can apply. |
Yes, it is not a big problem. It could be a minor nuisance when cherry-picking or backporting or bisecting, otherwise it is more an aesthetic issue.
Ok, haven't experienced it like that. I feel "knighted" when I get the 2 approving reviews. ;-) The actual details of the merging ceremony don't move me much; the important part is getting merged. |
Oh, interesting. I wonder how the other PR authors feel. It's not only about feelings, though. We really do need contributors to exercise their agency and also act very responsibly, because we have a lack of admin/maintainer workpower. And we need to keep giving authors repo permissions to set labels, etc., because there's not enough active members of cabal community with said permissions to garden the repo in the long run. We celebrate a dire need and a noble duty, not only personal excellence and community camaraderie. |
I share and support the ceremony sentiment that Mikolaj mentioned. I understand not everyone does. |
Perhaps from my perspective as a recent contributor; I could have properly read through the labels and realised I should use the squash+merge label and I think it's a mistake you make just once. It does feel good to be able to label it myself, makes you feel like you're 'in control' of your own PR. |
As mentioned in #8641, when running
cabal run +RTS
, there should be a warning that cabal consumes the+RTS
options. This is a first test for that, still requires implementing.