apache / apache/maven-surefire
[SUREFIRE-2080] plugin not correctly escaping paths with spaces on Windows
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Tim Allison](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tallison@mitre.org)** opened **[SUREFIRE-2080](https://issues.apache.org/jira/browse/SUREFIRE-2080?redirect=false)** and commented
Environment:
```
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
Maven home: C:\apache\apache-maven-3.8.5-bin\apache-maven-3.8.5
Java version: 1.8.0_322, vendor: Temurin, runtime: C:\Users\qwertyuiop\.jdks\temurin-1.8.0_322\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
```
When surefire forks a process, it is not putting double quotes around the -Djava.library.path.
```
-Djava.library.path=C:\Users\qwertyuiop\Intel lij\tika-2.3.0\tika-parsers\tika-parsers-standard\tika-parsers-standard-modules\tika-parser-ocr-module\..\..\..\..\tika-parent\lib
```
should be:
```
-Djava.library.path=\\"C:\Users\qwertyuiop\Intel lij\tika-2.3.0\tika-parsers\tika-parsers-standard\tika-parsers-standard-modules\tika-parser-ocr-module\..\..\..\..\tika-parent\lib\\"
```
relevant parts of debug log
```
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[DEBUG] Determined Maven Process ID 23984
[DEBUG] Fork Channel [1] connection string 'pipe://1' for the implementation class org.apache.maven.plugin.surefire.extensions.LegacyForkChannel
[DEBUG] boot classpath: C:\Users\qwertyuiop\.m2\repository\org\apache\maven\surefire\surefire-booter\3.0.0-M6\surefire-booter-3.0.0-M6.jar C:\Users\qwertyuiop\.m2\repository\org\apache\maven\surefire\surefire-api\3.0.0-M6\surefire-api-3.0.0-M6.jar ... C:\Users\qwertyuiop\.m2\repository\org\apache\maven\surefire\common-java5\3.0.0-M6\common-java5-3.0.0-M6.jar C:\Users\qwertyuiop\.m2\repository\org\junit\platform\junit-platform-launcher\1.8.2\junit-platform-launcher-1.8.2.jar
[DEBUG] boot(compact) classpath: surefire-booter-3.0.0-M6.jar ... common-java5-3.0.0-M6.jar junit-platform-launcher-1.8.2.jar
[DEBUG] Forking command line: cmd.exe /X /C "C:\Users\qwertyuiop\.jdks\temurin-1.8.0_322\jre\bin\java -Djava.library.path=C:\Users\qwertyuiop\Intel lij\tika-2.3.0\tika-parsers\tika-parsers-standard\tika-parsers-standard-modules\tika-parser-ocr-module\..\..\..\..\tika-parent\lib -jar C:\Users\qwertyuiop\AppData\Local\Temp\surefire4418642757462327849\surefirebooter8349798871024649967.jar C:\Users\qwertyuiop\AppData\Local\Temp\surefire4418642757462327849 2022-04-27T11-23-51_092-jvmRun1 surefire4635556381728461740tmp surefire_07657113776812865966tmp"
[DEBUG] Fork Channel [1] connected to the client.
Error: Could not find or load main class lij\tika-2.3.0\tika-parsers\tika-parsers-standard\tika-parsers-standard-modules\tika-parser-ocr-module\..\..\..\..\tika-parent\lib
[DEBUG] Closing the fork 1 after not saying Good Bye.
```
---
**Affects:** 3.0.0-M6
Contributor guide
Research direction
Reproduce the forked command on Windows using the Maven 3.8.5 and Java 8 environment described, focusing on the -Djava.library.path value containing spaces. Compare the failing debug command with the quoted form in the report; done means the path is passed as one argument and the forked test process starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100