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 186316

Summary: Debugger doesn't work in internal terminal if NetBeans is installed in path with spaces
Product: cnd Reporter: soldatov <soldatov>
Component: executionAssignee: Andrew Krasny <akrasny>
Status: VERIFIED FIXED    
Severity: normal CC: apepin, gorrus
Priority: P1    
Version: 6.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed fix

Description soldatov 2010-05-18 17:14:17 UTC
Debugger doesn't work in internal terminal if NetBeans is installed in "C:/Program Files" (windows) or "/Applications/NetBeans/NetBeans 6.9" (macos)
Scenario:
- Create Welcome project
- Set "Internal Terminal" mode
- Call context menu on project and select "Step into"
===>
java.io.IOException: /usr/bin/sh: line 1: /cygdrive/D/Program: No such file or directory
/usr/bin/sh: line 1: exec: /cygdrive/D/Program: cannot execute: No such file or directory
        at org.netbeans.modules.nativeexecution.pty.PtyAllocator.allocate(PtyAllocator.java:136)
        at org.netbeans.modules.nativeexecution.api.pty.PtySupport.allocate(PtySupport.java:118)
        at org.netbeans.modules.cnd.debugger.gdb.GdbDebugger.startDebugger(GdbDebugger.java:323)
        at org.netbeans.modules.cnd.debugger.gdb.actions.StartActionProvider.doAction(StartActionProvider.java:89)
[catch] at org.netbeans.modules.cnd.debugger.gdb.actions.StartActionProvider$1.run(StartActionProvider.java:134)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
/usr/bin/sh: line 1: /cygdrive/D/Program: No such file or directory
/usr/bin/sh: line 1: exec: /cygdrive/D/Program: cannot execute: No such file or directory
Comment 1 Andrew Krasny 2010-05-19 20:37:20 UTC
The main problem here is that pty helper utility cannot be started.
This could be fixed either by enclosing the path to the utility in quotes or by copying the utility in the 'safe' location (no spaces, no non-ascii chars) in case of 'bad' installation path. 

I would do both... 
The proposed patch is attached.

Vladimir, could you, please, review.
Comment 2 Andrew Krasny 2010-05-19 20:38:11 UTC
Created attachment 99220 [details]
Proposed fix
Comment 3 Egor Ushakov 2010-05-20 10:12:28 UTC
can we be sure that hinfo.getTempDirFile() path on Windows will not contain spaces?
Comment 4 Andrew Krasny 2010-05-20 10:56:08 UTC
yes, you're right.. In a default case (at least our days) I would say 'yes'. We are trying to make it so that path has no spaces. This is because we are using Windows short names.
But this short-names support could be switched off by tweaking Windows registry. In this case spaces/non-latin characters are possible (in current implementation).

So... Perhaps the hot-fix of this issue should be to enclose the path in quotes and just don't do this copy-to-safe-place magic. 

But we may want to return to this problem in future... 

What do you think?
Comment 5 Alexander Pepin 2010-05-20 11:20:40 UTC
Starting showstopper process.
Comment 6 Egor Ushakov 2010-05-20 12:10:10 UTC
If simple quoting helps (at least in general case) I would prefer doing only this.
Comment 7 Andrew Krasny 2010-05-20 14:08:37 UTC
OK, I agree.

Commit of P1 is here: http://hg.netbeans.org/cnd-main/rev/7f18fe42c7bb

Still will have problems with IDE installed in path with non-latin chars and Internal Terminal (but this is not a P1)
Comment 8 Egor Ushakov 2010-05-20 16:02:49 UTC
This fix looks safe.
Please add a comment why you get PATH from MacroMap
Comment 9 Alexander Pepin 2010-05-20 17:52:44 UTC
verified in dev cnd build from bertram.
please push to release69 clone.
Comment 10 Vladimir Kvashin 2010-05-20 19:38:48 UTC
Integrated in release69:
http://hg.netbeans.org/release69/rev/a453027b4642
Comment 11 soldatov 2010-05-24 07:16:19 UTC
verified in RC1