Bug 505746 - A colon in the project name causes an NPE
Summary: A colon in the project name causes an NPE
Status: ASSIGNED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 9.2.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-11 19:59 EDT by Sergey Prigogin CLA
Modified: 2020-09-04 15:24 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Prigogin CLA 2016-10-11 19:59:08 EDT
To reproduce create a project called "foo:bar" and run a debug configuration with the default working directory, ${workspace_loc:foo:bar}.

CDT converts the colon to double colon, which causes GDB to fail with:

705,536 4-environment-cd /workspace/foo::bar
705,536 4^error,msg="/workspace/foo::bar: No such file or directory."

The problem manifests itself as an NPE:

java.lang.NullPointerException
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl.getId(GDBControl.java:274)
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_4.createComandControlContext(GDBControl_7_4.java:49)
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl.doInitialize(GDBControl.java:256)
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl.access$0(GDBControl.java:250)
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl$1.handleSuccess(GDBControl.java:245)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleCompleted(RequestMonitor.java:385)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor$2.run(RequestMonitor.java:312)
	at org.eclipse.cdt.dsf.concurrent.ImmediateExecutor.execute(ImmediateExecutor.java:63)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.done(RequestMonitor.java:309)
	at org.eclipse.cdt.dsf.service.AbstractDsfService.initialize(AbstractDsfService.java:93)
	at org.eclipse.cdt.dsf.gdb.service.command.GDBControl.initialize(GDBControl.java:242)
	at org.eclipse.cdt.dsf.gdb.launching.ServicesLaunchSequence$2.execute(ServicesLaunchSequence.java:57)
	at org.eclipse.cdt.dsf.concurrent.Sequence.executeStep(Sequence.java:459)
	at org.eclipse.cdt.dsf.concurrent.Sequence.access$2(Sequence.java:373)
	at org.eclipse.cdt.dsf.concurrent.Sequence$2.handleSuccess(Sequence.java:420)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor.handleCompleted(RequestMonitor.java:385)
	at org.eclipse.cdt.dsf.concurrent.RequestMonitor$2.run(RequestMonitor.java:312)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:295)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

This is a recent regression.
Comment 1 Eclipse Genie CLA 2016-10-12 15:15:29 EDT
New Gerrit change created: https://git.eclipse.org/r/83058
Comment 2 Marc Dumais CLA 2016-10-12 15:16:05 EDT
There might be a timing component to this bug - On my machine I am able to reproduce the problem of CDT changing "foo:bar" to "foo::bar", when computing the workspace project path, to give to GDB. However, for me, the NPE is not present.

At first look, there are some other issues with having a column character in the project name; for instance, the build system doesn't seem to be able to generate a valid makefile, for the project, in that case. That seem to happen when I used the wizard to create an "hello world" type project, and named it "foo"bar", to this this bug. 

In any case, I'll add a patch that gets rid of the extra column character, during the launch sequence. It might at least hide this NPE, but it's possible the real issue would still be latent. 

Sergey - give it a try and report what happens?
Comment 3 Sergey Prigogin CLA 2016-10-12 18:02:36 EDT
(In reply to Marc Dumais from comment #2)
There is definitely a race between processing of the gdb-reported error, which causes the session to end, and the concurrent activities still running at this time. The NPE goes away if I put "if (DsfSession.isSessionActive(fSession.getId()))" in front of line 57 in ServicesLaunchSequence.java. Even with this change the behavior is unsatisfactory since the gdb-reported error is logged to the error log, but not reported to the user.

https://git.eclipse.org/r/83058 fixes the issue with doubling of semicolon.