This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208065 - maven doesn't start when nb is installed in directory containing an "="
Summary: maven doesn't start when nb is installed in directory containing an "="
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on: 153101
Blocks: 164234
  Show dependency tree
 
Reported: 2012-02-04 17:23 UTC by SimonSilvaLauinger
Modified: 2012-05-01 09:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
additonal escaping (944 bytes, text/plain)
2012-02-23 15:57 UTC, Milos Kleint
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SimonSilvaLauinger 2012-02-04 17:23:35 UTC
When NetBeans is installed in an folder containing an "=" maven can not be started. In my case I have NetBeans installed in "C:\\Users\\simon\\AppData\\Local\\0install.net\\implementations\\sha256=9e7a3fbdc0c87b7f12e14529f444345ae709a45310449428026c5257cbb1fc56\\java\\maven\\bin\\mvn.bat" The error message then is "'C:\Users\simon\AppData\Local\0install.net\implementations\sha256' is not recognized as an internal or external command, operable program or batch file." . I think this is because the Maven startup script does not put the filepath in quotes. Therefore Windows can not handle special chars such as spaces and equals signs.
Comment 1 Milos Kleint 2012-02-08 07:51:35 UTC
can you reproduce the same behaviour from cmd line? if so, the problem should probably be filed at the maven issue tracking system - http://jira.codehaus.org/browse/MNG
Comment 2 SimonSilvaLauinger 2012-02-16 14:43:34 UTC
It depends on the way I try to start maven.
On the command line it just works when I put the path in quotes, e.g. "C:\\Users\\simon\\AppData\\Local\\0install.net\\implementations\\sha256=9e7a3fbdc0c87b7f12e14529f444345ae709a45310449428026c5257cbb1fc56\\java\\maven\\bin\\mvn.bat"
Without the quotes, e.g. C:\\Users\\simon\\AppData\\Local\\0install.net\\implementations\\sha256=9e7a3fbdc0c87b7f12e14529f444345ae709a45310449428026c5257cbb1fc56\\java\\maven\\bin\\mvn.bat the command line returns "'C:\Users\simon\AppData\Local\0install.net\implementations\sha256' is not
recognized as an internal or external command, operable program or batch file." . I'm sure NetBeans starts the program without quotes. This must be fixed.
Comment 3 Jesse Glick 2012-02-20 19:17:02 UTC
I suppose ShellConstructor.quoteSpaces needs to call Utilities.escapeParameters and also separately escape/quote '=' on Windows (but do nothing special on Unix).

Workaround is maybe to run IDE with -J-Dmaven.run.cmd=true (in netbeans.conf).
Comment 4 Milos Kleint 2012-02-21 16:38:39 UTC
https://hg.netbeans.org/core-main/rev/6492d0b3a40d

= in patch fixed

jesse, I didn't completed understand the Utilities.escapeParameters() call, what cases does it cater for? the = in path seemed to get fixed without it..
Comment 5 Jesse Glick 2012-02-21 19:21:30 UTC
(In reply to comment #4)
> I didn't [completely] understand the Utilities.escapeParameters() call,
> what cases does it cater for? the = in path seemed to get fixed without it..

And ' ' as well. escapeParameters would deal with other metacharacters, such as '"' or '\\' (but not '=' since it was designed to be used for argc[1..] rather than argc[0]).

IMHO it is a bug in the Windows JRE that argument #0 to ProcessBuilder needs to be escaped; the whole point of passing individual arguments rather than a single parsed String is to avoid the need to escape anything, i.e. bypass shell quoting rules. If someone can explain how Windows deals with metacharacters in commands I would be gratified.
Comment 6 Quality Engineering 2012-02-22 11:01:54 UTC
Integrated into 'main-golden', will be available in build *201202220400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6492d0b3a40d
User: Milos Kleint <mkleint@netbeans.org>
Log: #208065 quote maven path with = character, when executing maven on windows
Comment 7 Milos Kleint 2012-02-23 15:57:19 UTC
Created attachment 116066 [details]
additonal escaping

Jesse, you had something like the attached patch in mind? I'm not feeling entirely positive about escaping some meta chars and then possibly wrapping everything into quotes if = is present..
Comment 8 Jesse Glick 2012-02-27 23:52:35 UTC
No, that would not work if you had both ' ' and '=' for example. Possibly escapeParameters should always quote params containing '='?
Comment 9 Jesse Glick 2012-02-27 23:53:20 UTC
(In reply to comment #8)
> Possibly escapeParameters should always quote params containing '='?

Never mind, that would be very annoying for actual parameters, as opposed to the program argc[0].
Comment 10 cbl 2012-02-28 10:46:58 UTC
There are more delimiter characters like ' ' and '='.

cmd.exe also regards the following as delimiters (they separate command line arguments):

- comma
- semicolon
- Tab

So, these characters would need escaping / quoting too, when handed over to cmd.exe.
Comment 11 Milos Kleint 2012-04-27 08:56:10 UTC
http://hg.netbeans.org/core-main/rev/21277ab0917c
Comment 12 Quality Engineering 2012-05-01 09:53:53 UTC
Integrated into 'main-golden', will be available in build *201205010400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/21277ab0917c
User: Milos Kleint <mkleint@netbeans.org>
Log: #208065 not only space and = but also ; and , need quoting