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

Fix CommandParser incorrectly handling multiple end-of-option delimiters #3541

Merged
merged 4 commits into from
May 7, 2020

Conversation

KittyMac
Copy link
Contributor

@KittyMac KittyMac commented May 6, 2020

Previously, the command parser would swallow all "--" after the first
one. For me, this manifested itself in not allowing corral to be used
with lldb "corral exec -- lldb ponyc -- $(ponyc) -V=0 -o ./build/
./utility" since the second "--" is required to be passed to lldb.

This change is dependency for a PR being submitted to corral to allow
use of corral with lldb (for debugging ponyc itself).

Previously, the command parser would swallow all "--" after the first
one. For me, this manifested itself in not allowing corral to be used
with lldb "corral exec -- lldb ponyc -- $(ponyc) -V=0 -o ./build/
./utility" since the second "--" is required to be passed to lldb.

This change is dependency for a PR being submitted to corral to allow
use of corral with lldb (for debugging ponyc itself).
@SeanTAllen
Copy link
Member

Thanks @KittyMac,

Are there any tests that can be provided to verify that it works and most importantly that it won't get accidentally broken in the future?

@SeanTAllen SeanTAllen requested a review from mfelsche May 6, 2020 21:38
@SeanTAllen
Copy link
Member

@mfelsche I think you know the cli pretty well. Can you review this? Does this could as a changelog- changed, changelog - added or what?

@SeanTAllen
Copy link
Member

@KittyMac Can you write up a nice "end user friendly" description of this change for the release notes and add them as a comment on this PR?

@KittyMac
Copy link
Contributor Author

KittyMac commented May 6, 2020

I see the cli tests now, I can add some when/if @mfelsche confirms the change is correct.

Guideline 10 of the standard says "The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character." The parser currently swallows all "--" after the first one, not allowing the arguments to be passed along verbatim.

So, end user friendly description might be:

"Fixed an issue where CommandParser was incorrectly handling cases when arguments contain multiple end-of-option delimiters"

@mfelsche
Copy link
Contributor

mfelsche commented May 6, 2020

So, if i understand this right, with this change, all tokens after a -- are interpreted as arguments.
If this is the intended behavior then all is good, i think.

A test showing that a second -- is indeed part of the arguments would be cool though.

KittyMac added 3 commits May 6, 2020 20:29
Squashed commits:
[9ab2aab] Stop swallowing "--" after the first one is processed by command parser

Previously, the command parser would swallow all "--" after the first
one. For me, this manifested itself in not allowing corral to be used
with lldb "corral exec -- lldb ponyc -- $(ponyc) -V=0 -o ./build/
./utility" since the second "--" is required to be passed to lldb.

This change is dependency for a PR being submitted to corral to allow
use of corral with lldb (for debugging ponyc itself).
@SeanTAllen SeanTAllen added the do not merge This PR should not be merged at this time label May 7, 2020
@SeanTAllen
Copy link
Member

This shouldnt be merged til after the 0.34.1 hot fix release that is happening tomorrow. I've marked "DO NOT MERGE" accordingly.

@SeanTAllen SeanTAllen removed the do not merge This PR should not be merged at this time label May 7, 2020
@SeanTAllen
Copy link
Member

I'm removing the DO NOT MERGE tag 0.34.1 has been released.

@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label May 7, 2020
@SeanTAllen SeanTAllen changed the title Stop swallowing "--" after the first one is processed by command parser Fix CommandParser incorrectly handling cases when arguments contain multiple end-of-option delimiters May 7, 2020
@SeanTAllen SeanTAllen changed the title Fix CommandParser incorrectly handling cases when arguments contain multiple end-of-option delimiters Fix CommandParser incorrectly handling multiple end-of-option delimiters May 7, 2020
Copy link
Contributor

@mfelsche mfelsche left a comment

Choose a reason for hiding this comment

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

Cool cool cool

@mfelsche mfelsche merged commit 87b473d into ponylang:master May 7, 2020
github-actions bot pushed a commit that referenced this pull request May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants