JDK-8074973 : Command line arguments with *\ combinations get repeated \ characters.
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 6u17,7u10,7u40,8u40,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2015-03-06
  • Updated: 2015-12-09
  • Resolved: 2015-12-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Window 7, and Windows XP

A DESCRIPTION OF THE PROBLEM :
Also occurs with jre7.

Starting a java application with, say:

java.exe -cp someclasspath ClassName '.\*\*\*'

results in the relevant main() method being invoked with an argument of:

\*\\*\\\*

each subsequent *\ getting an additional backslash added.




REGRESSION.  Last worked in version 6u45

ADDITIONAL REGRESSION INFORMATION: 
The bug DOES NOT occur on this platform:

java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Define the class given below

compile it and run it with:

javac -cp . Star '\*\*\*\*\*'

and observe the outputs.

You can experiment with various quotes and, as near as I can tell, the results are always wrong. It seems to be very specific to the *\ combination, as well.

Try out '.\*\*\foo\*\*\*\bar' for instance. It gets interesting.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect it to print out

\*\*\*\*\*'
ACTUAL -
But instead it prints out

\*\\*\\\*\\\\*\\\\\*'

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No errors are reported

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class Star {
	public static void main(String[] args) {
		for(int i = 0; i < args.length; i++) {
			String a = args[i];
			System.out.println(a);
		}
	}
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have not found anything.


Comments
Duplicate of JDK-8143640
09-12-2015

This is caused by fix for JDK-7146424 (cmdtoargs.c) in 7u10, 7u40 and 7u45. This is due to change in the behavior of wildcard processing on Windows. Using wildcards on Windows is tricky, and should be used carefully. This is not a regression in 8u40, it has been around since 7u10, 7u40. ILW => MLH => P4.
29-05-2015

Test Result : Scenario 1 ######### Windows 7 64 bit with JDK 8u40 ea b18 : ---------------------------------------------------------- C:\Abhijit\batch>java -version java version "1.8.0_40-ea" Java(TM) SE Runtime Environment (build 1.8.0_40-ea-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.40-b22, mixed mode) C:\Abhijit\batch>cd .. C:\Abhijit>javac -cp C:\Abhijit\Star.java;.; javac: no source files Usage: javac <options> <source files> use -help for a list of possible options C:\Abhijit>javac -cp . Star '\*\*\*\*\*' javac: invalid flag: '\*\\*\\\*\\\\*\\\\\*' Usage: javac <options> <source files> use -help for a list of possible options ------------------------------------------------------------------------------------------------- Scenario 2 ########### Windows 7 64 bit with JDK 6u29 b11 ----------------------------------------------- C:\Abhijit\batch>java -version java version "1.6.0_29" Java(TM) SE Runtime Environment (build 1.6.0_29-b11) Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode) C:\Abhijit\batch>cd .. C:\Abhijit>javac -cp . Star '\*\*\*\*\*' javac: invalid flag: '\*\*\*\*\*' Usage: javac <options> <source files> use -help for a list of possible options
11-03-2015