-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Avoid parsing MAVEN_OPTS (3.9.x) #10969
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
Conversation
Fixes apache#10937 by introducing an additional INTERNAL_MAVEN_OPTS for any arguments that need to be inserted by the script. Parsing the externally-defined MAVEN_OPTS variable can lead to incorrect processing of quotes and special characters, so use the separate variable to avoid doing so.
|
I'm a bit unsure of how to add IT tests to 3.9.x -- do they go into the old repo? |
Yes for 3.9.x old repo with ITs are used ... Please fork it, create branch with the same name as in this PR - |
I have added tests under apache/maven-integration-testing#407 At the moment they are still their own file, as the MNG-4559 tests you suggested I extend in #10970 (comment) do not exist in the 3.9.x branch. If it's better to keep the same name in both please let me know and I will amend the PR. |
|
Ah that's annoying... looks like whether the quotes are retained or not differ between Windows and *nix. This isn't even behaviour changed by this PR, just a difference exposed by the new test :\ |
| "%JAVACMD%" --enable-native-access=ALL-UNNAMED -version >nul 2>&1 | ||
| if ERRORLEVEL 1 goto skipEnableNativeAccess | ||
| set "MAVEN_OPTS=--enable-native-access=ALL-UNNAMED %MAVEN_OPTS%" | ||
| set "INTERNAL_MAVEN_OPTS=--enable-native-access=ALL-UNNAMED %INTERNAL_MAVEN_OPTS%" |
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 don't think we should expose this new variable. Which means we need to set it to an empty string before trying the line 176, so that a value coming from the user env would not interfere.
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.
Good point, I've pushed a change to clear this variable at the top of the script.
|
I have updated the tests for 3.9.x to strip quotes when checking results, and verified it works as expected on Linux (Debian). Unfortunately I do not have any access to macOS so will need to rely on CI to verify those. Expectation currently is that |
Fixes apache#10937 by introducing an additional INTERNAL_MAVEN_OPTS for any arguments that need to be inserted by the script. Parsing the externally-defined MAVEN_OPTS variable can lead to incorrect processing of quotes and special characters, so use the separate variable to avoid doing so.
Fixes #10937 by introducing an additional INTERNAL_MAVEN_OPTS for any arguments that need to be inserted by the script. Parsing the externally-defined MAVEN_OPTS variable can lead to incorrect processing of quotes and special characters, so use the separate variable to avoid doing so.
Specifically, this fixes this case:
by implementing proposed fix 2 from #10937
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verifyto make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.