dhananjay6561 opened a new pull request, #3636: URL: https://github.com/apache/maven-surefire/pull/3636
Fixes #3619. `ModularClasspathForkConfiguration.createArgsFile` writes the module path, the class path and the `--patch-module` directory as quoted values in the `@argfile`, but only escaped backslashes. A path containing `"` closed the quoted value early, and a CR or LF split it across lines, so the forked JVM could get different options than intended. The java launcher reads `\"`, `\r` and `\n` inside a quoted argfile value as a literal quote, CR and LF, so this adds a small `escapeQuoted` helper that escapes those along with the backslash, and uses it for the three quoted values. The remaining lines (module name, test packages, the start class and the provider `--add-opens`/`--add-exports` arguments) are module, package and class names, which can't contain these characters, so they are left as they are. Test: `ModularClasspathForkConfigurationTest.shouldEscapeQuotesAndLineBreaksInArgsFile` passes paths with `"`, CR and LF and checks that the args file still has 13 lines with the escaped values. --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
