Avoid parsing MAVEN_OPTS (master/4.x) by BobVul · Pull Request #10970 · apache/maven (original) (raw)

@BobVul

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.

Additionally JVM_CONFIG_MAVEN_OPTS is introduced as its own variable to preserve the append behaviour.

@BobVul marked this pull request as draft

July 21, 2025 07:52

@BobVul

Remove quotes from the new JVM_CONFIG_MAVEN_OPTS to also allow quoted pipes to work from jvm.config This is a follow-up to apache#10937, where the extra layer of quotes causes parsing issues in Windows cmd

@BobVul BobVul marked this pull request as ready for review

July 21, 2025 10:25

@BobVul

Test that adding pipes to either MAVEN_OPTS or jvm.config does not break anything Note: it is important that a jvm.config exists for the MAVEN_OPTS portion of the test to work

slawekjaranowski

@BobVul BobVul marked this pull request as draft

July 21, 2025 15:49

@BobVul

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.

@BobVul

By default xargs handles quotes specially. To avoid this behaviour, -0 must be used instead, but first we need to convert LF to NUL. Since quotes are no longer being stripped by xargs, we should also stop trying to add them back in otherwise nested quotes cause further issues

@BobVul BobVul marked this pull request as ready for review

July 21, 2025 17:04

gnodet pushed a commit to gnodet/maven that referenced this pull request

Jul 24, 2025

@BobVul

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.

Additionally JVM_CONFIG_MAVEN_OPTS is introduced as its own variable to preserve the append behaviour.

Remove quotes from the new JVM_CONFIG_MAVEN_OPTS to also allow quoted pipes to work from jvm.config This is a follow-up to apache#10937, where the extra layer of quotes causes parsing issues in Windows cmd

Test that adding pipes to either MAVEN_OPTS or jvm.config does not break anything Note: it is important that a jvm.config exists for the MAVEN_OPTS portion of the test to work

By default xargs handles quotes specially. To avoid this behaviour, -0 must be used instead, but first we need to convert LF to NUL. Since quotes are no longer being stripped by xargs, we should also stop trying to add them back in otherwise nested quotes cause further issues


Co-authored-by: Bob BobVul@users.noreply.github.com (cherry picked from commit aeff353)

gnodet added a commit that referenced this pull request

Jul 24, 2025

@gnodet @BobVul

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.

Additionally JVM_CONFIG_MAVEN_OPTS is introduced as its own variable to preserve the append behaviour.

Remove quotes from the new JVM_CONFIG_MAVEN_OPTS to also allow quoted pipes to work from jvm.config This is a follow-up to #10937, where the extra layer of quotes causes parsing issues in Windows cmd

Test that adding pipes to either MAVEN_OPTS or jvm.config does not break anything Note: it is important that a jvm.config exists for the MAVEN_OPTS portion of the test to work

By default xargs handles quotes specially. To avoid this behaviour, -0 must be used instead, but first we need to convert LF to NUL. Since quotes are no longer being stripped by xargs, we should also stop trying to add them back in otherwise nested quotes cause further issues


(cherry picked from commit aeff353)

Co-authored-by: Bob 1674237+BobVul@users.noreply.github.com Co-authored-by: Bob BobVul@users.noreply.github.com

gnodet pushed a commit to gnodet/maven that referenced this pull request

Jul 24, 2025

@BobVul @gnodet

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.

Additionally JVM_CONFIG_MAVEN_OPTS is introduced as its own variable to preserve the append behaviour.

Remove quotes from the new JVM_CONFIG_MAVEN_OPTS to also allow quoted pipes to work from jvm.config This is a follow-up to apache#10937, where the extra layer of quotes causes parsing issues in Windows cmd

Test that adding pipes to either MAVEN_OPTS or jvm.config does not break anything Note: it is important that a jvm.config exists for the MAVEN_OPTS portion of the test to work

By default xargs handles quotes specially. To avoid this behaviour, -0 must be used instead, but first we need to convert LF to NUL. Since quotes are no longer being stripped by xargs, we should also stop trying to add them back in otherwise nested quotes cause further issues


Co-authored-by: Bob BobVul@users.noreply.github.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})