-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CommandLineSupport: Do not escape backslash on Windows #1559
Comments
Hi @michael-o thanks for reporting this! Indeed we don't run our regression tests on windows. Indeed it looks like windows has different escape logic. Do you know how Maven handles this and if there is an implementation or test suite we can use as a reference? |
Yes, Maven delegates this to Maven Shared Utils which includes a system specific command launcher. For now, I have modified this in Surefire: https://github.com/apache/maven-surefire/pull/705/files Maven logic used throughout: https://github.com/apache/maven-shared-utils/tree/maven-shared-utils-3.4.2/src/main/java/org/apache/maven/shared/utils/cli. Entrypoint for you https://github.com/apache/maven-shared-utils/blob/2dc9eb5ea2b4ed2573bd96282a16e0340083c87a/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java#L76-L79. It will either pick Bourne shell or I consider the current escaping completely designed for Bourne shell. |
Steps to reproduce
Have a look at this config snippet in Maven Surefire: https://github.com/apache/maven-surefire/blob/83c466698f1cf38d7b60852549393f4245f286d4/surefire-its/pom.xml#L136-L156
It produces the following output:
Expected behaviour
cmd.exe
does not require bashslashes to be escaped. I have extracted the code from Maven Surefire:Output:
The underlying implementation for calling the command is in Maven Shared Utils and will handle this w/o the double escaping.
Actual behaviour
Backslashes are uselessly escaped because
CommandLineSupport
does not differentiate between Bourne Shell input andcmd.exe
.This was foundw hile working on https://issues.apache.org/jira/browse/SUREFIRE-1810 and reported as https://issues.apache.org/jira/browse/SUREFIRE-2225.
Luckily both
File
andPath
normalize two backslashes to one...The text was updated successfully, but these errors were encountered: