-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
[WIP] Add a check for bad opts which are abbrev of good #3657
Conversation
An abbreviation of an AddOption'd option now gives a warning. Also a warning issued for another AddOption problem - nargs > 1 Signed-off-by: Mats Wichmann <mats@linux.com>
Fold in pending rewordings for AddOption shared description. "Fix" longopts test by remembering it needs to do regex matching because the framework filename-message match string was added. Signed-off-by: Mats Wichmann <mats@linux.com>
Adds a post-processing step called after sconscript processing is done which checks if there are any leftover options. Previously, some options would sneak through silently if they were an abbreviation of another option added by AddOption. Fixes SCons#3653 Signed-off-by: Mats Wichmann <mats@linux.com>
An abbreviation of an AddOption'd option now gives a warning. Also a warning issued for another AddOption problem - nargs > 1 Signed-off-by: Mats Wichmann <mats@linux.com>
Fold in pending rewordings for AddOption shared description. "Fix" longopts test by remembering it needs to do regex matching because the framework filename-message match string was added. Signed-off-by: Mats Wichmann <mats@linux.com>
MongoDB slack channels are complaining about this. Any progress? Proposed fix from someone in the mongodb slack channel, but I suppose its not this simple:
Now you would get:
|
I kind of got lost in several overlapping changesets that have to do with the broken option handling. Will swing back and take a look - it might work out to be "that simple" just for this issue. |
@mwichmann - If the simple fix is acceptable, I think it would be worthwhile getting a version of it committed so it can make the next 4.0 point release. That would let us easily cherry-pick it into our vendored SCons, and remove a very frustrating user experience related bug. |
Okay, I'll have a dig. |
@mwichmann - Did your digging reveal anything along the lines of the simple fix? |
My shovel went missing temporarily.... |
@mwichmann and @dmoody256 - I think it would be worthwhile to revisit this and see if the proposed simple fix really does work. It keeps burning people when they leave terminal letters off of important options and then are deeply perplexed when their build breaks. If a more comprehensive change is required, that's fine. But if the little fix works, it really seems like a worthy UX improvement without much risk. |
The patch detects at least the case in the testcase I put together, which means it would be useful. For anyone reading this - should this be an error or a warning? It seems I had coded this PR to issue a warning, but bad options are usually an error, so I'm now more inclined to go with what the patch collected from Mongo slack proposed. |
I think as a stopgap before the behavior of intrinsic options and user declared options can be harmonized, it should be an error. Warnings have a tendency to scroll right by as the build starts and get missed. Since the failure mode here is that user declared options get silently ignored when they are prefix-y, I think there is a strong case for making it an error. |
Error seems correct. Though weird.. that's possible.. |
surely that wouldn't trigger on a --longopt? |
Fascinating... I asked on Discord not too long ago why errors emit |
My inclination is to push a new PR rather than try to adapt this one, since this has some other stuff in it and the commit history would end up confusing. There's still some reason why I wanted the post-process approach but right now I can't (quickly) prove it's necessary. |
Withdrawing this in favor of #3784, will archive for reference. |
Adds a post-processing step called after sconscript processing is done which checks if there are any leftover options. Previously, some options would sneak through silently if they were an abbreviation of another option added by AddOption.
Marked as WIP to see if this is a suitable approach. There was also some discussion of having this transition in gradually as a warning/deprecationwarning.
Note: at the moment this has some surprises. Test
test/option-unknown.py
tries a long option where noAddOption
calls have taken place at all, and it still triggers the abbreviation warning.Fixes #3653
Signed-off-by: Mats Wichmann mats@linux.com
Contributor Checklist:
CHANGES.txt
(and read theREADME.rst
)