Bug 212264 - Wildcard arguments to main() method are automatically expanded
Summary: Wildcard arguments to main() method are automatically expanded
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 235406 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-07 09:05 EST by Gregor Rosenauer CLA
Modified: 2023-02-11 17:05 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Rosenauer CLA 2007-12-07 09:05:06 EST
Build ID: M20071023-1652

Steps To Reproduce:
1. create a launch configuration for a simple Java app that has a main(String[] args) method
2. in the launch editor, pass an argument "*.java"
3. when debugging into main, the argument is automatically expanded into all files that match the pattern


More information:
1. why is Eclipse JDT assuming every wildcard-parameter are files?
2. why is it acting super-intelligent even when using "quotes" to circumvent this A.I.?
3. why is it acting differently than Sun's JRE that correctly passes the wildcards when invoked from the commandline (only with the argument in quotes)?

Please ensure that quoted arguments are not expanded in any way. I tried with Java5/Java6, same in Eclipse (=not working) and on the command line (=working)
Comment 1 Darin Wright CLA 2008-06-03 13:37:32 EDT
This appears to be a WinXP behavior. I don't think we have control over it.
Comment 2 Darin Wright CLA 2008-06-03 13:37:59 EDT
*** Bug 235406 has been marked as a duplicate of this bug. ***
Comment 3 Jeff McAffer CLA 2008-06-03 21:29:30 EDT
is it OS specific of VM specific?  I'm wondering if exec() is just implemented differently.  I assume that when we launch Eclipse we are actully just exec()'ing something (java.exe?  eclipse.exe?)
Comment 4 Darin Wright CLA 2008-06-03 22:30:58 EDT
Launching something usually comes down to using java.lang.Runtime.exec(...). For Java apps, we exec java.exe. For Eclipse, I don't recall if it is eclipse.exe or java.exe...

However, it appears that on WinXP, when "*" is passed as a command line parameter, it is expanded. Same thing happens from the command line.

The bug is that from the command line, a quoted asterix ("*") just passes * whereas from Eclipse, a quoted asterix does end up as a literal.
Comment 5 Darin Wright CLA 2008-06-03 22:31:45 EDT
(In reply to comment #4)
> a quoted asterix does end up as a literal.

does *not* end up as a literal.

Comment 6 Darin Wright CLA 2008-06-03 22:39:17 EDT
Looks like a bug in our ArgumentsParser. If I intercept the command line and add the quotes explicitly, it works.

Targeting for 3.4.1, as this is delicate code with OS specifics.
Comment 7 Darin Wright CLA 2008-07-29 11:29:25 EDT
Moving to 3.5 unless this is blocking anyone.
Comment 8 Darin Wright CLA 2009-04-07 16:27:03 EDT
and so it goes... not planned for 3.5. 
Comment 9 Michael Scheper CLA 2013-08-07 00:07:50 EDT
Still experiencing this bug, another four years later, in Windows 7.
Comment 10 Eugene Fridman CLA 2014-09-18 23:17:29 EDT
The bug is still present in Eclipse Luna (Release (4.4.0)) and continues to confuse people.
Comment 11 Arno Unkrig CLA 2015-07-13 09:42:15 EDT
This is apparently a bug (or an undocumented feature?) in "java.exe" of all Java versions up to and including (at least) Java 8: With SYSINTERNALS PROCEXP, you see "*" in the command line of the running java.exe process, but "args[]" contains the expanded file names.

I am desperately searching for a workaround that suppresses this nasty command line expansion - any help appreciated!
Comment 12 Eclipse Genie CLA 2021-01-12 19:16:05 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 13 Eclipse Genie CLA 2023-02-11 17:05:18 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.