Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364924

Summary: Space with dash in path with --exec option will cause VM to fail to start
Product: [RT] Jetty Reporter: Éric Daigneault <eric.daigneault>
Component: serverAssignee: Thomas Becker <tbecker>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: janb, jesse.mcconnell, jetty-inbox, simone.bordet, tbecker
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=369349
Whiteboard:
Attachments:
Description Flags
proposed patch none

Description Éric Daigneault CLA 2011-11-27 21:16:02 EST
Build Identifier: jetty-7.2.2.v20101205 tried many builds up to last 8.x milestone)

When putting a dash in the path preceded by a space and --exec option is enabled in the .ini file (or the command Line) the VM will fail to start citing an unknown argument "-".

The problem was reliably reproduced with multiple builds starting from 7.2.2 all the way to the last nightly build of 8.  Possibly earlier builds are failing as well though I have not tried them).

Now knowing the problem it is quite easy to find a workaround however since spaces in paths should normally be supported this problem incurred a long and frustrating troubleshooting experience.  I am flagging this as critical because the whole system simply does not start, however the workaround is very simple...   just remove the spaces in the path.

The problem was reliably reproduced on different windows system (XP, 7, 7x64 2008, 2008r2) both with 32 and 64 bits VM (all in the 6 range from Oracle).

the following question on SO describes the problem
http://stackoverflow.com/questions/8255563/jetty-cannot-start-unable-to-create-the-virtual-machine-when-i-add-the-exec/8259148#8259148


Reproducible: Always

Steps to Reproduce:
1. Get a Jetty build (any from 7.2.2)
2. expand the archive in a folder and edit the name such that it contains a space followed by a dash (ex "jetty-7.2.2.v20101205 - prod").
3. Edit the ini file and enable the --exec option
4. make sure you have a war (the test war delivered with the archive will do)
5. start jetty (java -jar start.jar)
6. failed

The procedure was reliably applied to multiple builds and the defective behavior was reproduced every times.
Comment 1 Thomas Becker CLA 2011-12-05 08:20:45 EST
It can be fixed by tokenizing the commandline options in Main.java into a String[] and calling Runtime.exec(String[], ...) instead of Runtime.exec(String,...). The latter tokenizes by spaces and that's why the CMDL breaks.

However having spaces and dashes combined in a directory path is a very bad idea and can have other side effects as well. So I'd just say we don't support spaces+dashes in directory names.
Comment 2 Jesse McConnell CLA 2011-12-05 08:50:31 EST
marking enhancement, a patch will make it get reviewed and implemented faster, otherwise we'll add it to the 'todo' list
Comment 3 Thomas Becker CLA 2012-01-30 07:18:37 EST
I haven't looked at the code (yet) as I need to urgently find out why --exec is not working properly anymore.

But just not to forget it, I'd like to check if this change by Joakim probably fixed this as well:

commit 3df95d45c27c924c1f0e76c4c16a3f796ddf2470
Author: Joakim Erdfelt <joakim.erdfelt@gmail.com> 2012-01-20 19:27:38
Committer: Joakim Erdfelt <joakim.erdfelt@gmail.com> 2012-01-20 19:27:38
Parent: 58c57a9ea0288acf80e52b85e35349811d88fb5a (367635: report errors)
Child: bc5ac3622aa39b6e60b96ab24b0fb11c09535172 (369349 replace quotes with a space escape method)
Branches: origin/central-orbit-repo, origin/master, master, origin/HEAD
Comment 4 Thomas Becker CLA 2012-02-01 04:22:52 EST
Created attachment 210361 [details]
proposed patch

fix for --dry-run attached
Comment 5 Thomas Becker CLA 2012-02-01 04:23:30 EST
Comment on attachment 210361 [details]
proposed patch

attached to the wrong issue
Comment 6 Thomas Becker CLA 2012-02-03 08:34:37 EST
Just tested it, this one is fixed together with the patch provided for: https://bugs.eclipse.org/bugs/show_bug.cgi?id=369349

--exec works fine in a directory called "jetty\ space\ \ -\ space/"
Comment 7 Thomas Becker CLA 2012-03-29 13:39:36 EDT
Closing this as fixed/duplicate. Although https://bugs.eclipse.org/bugs/show_bug.cgi?id=369349 needs to be committed first.