Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339758 - RSE TCF: Processes with "/0" in the names are not properly reported in TM
Summary: RSE TCF: Processes with "/0" in the names are not properly reported in TM
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: RSE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.4.0   Edit
Assignee: Eugene Tarassov CLA
QA Contact: Anna Dushistova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 15:06 EST by Martin Oberhuber CLA
Modified: 2013-06-05 05:54 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot with the problem (23.66 KB, image/png)
2011-03-11 15:06 EST, Martin Oberhuber CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2011-03-11 15:06:16 EST
Created attachment 191027 [details]
Screenshot with the problem

CQ:WIND00259395

On an RSE connection against a Linux TCF agent, Proceses with "/0" in the names are reported with a "0" name in the RSE Processes subsystem.

See attached screenshot
Comment 1 Doug Schaefer CLA 2011-03-14 10:05:53 EDT
I don't see this coming back in the protocol. This must be something the RSE integration is doing.
Comment 2 Anna Dushistova CLA 2011-03-14 22:09:15 EDT
I'll take a look.
Comment 3 Anna Dushistova CLA 2011-03-15 18:55:42 EDT
The problem is in the TCFProcessResource#getName():
...
            int i = s.lastIndexOf('/');
            int j = s.lastIndexOf('\\');
            if (j > i) i = j;
            if (i > 0) s = s.substring(i + 1);
...
The code is perfectly fine for normal processes but will return 0 for, say, softirq/0. I am not sure how to fix it properly, because you can create a file named "0" inside a directory "softirq" and then the returned result will be correct.
Comment 4 Martin Oberhuber CLA 2011-04-06 12:53:26 EDT
Linux "top" and "ps" know the difference between the process name ("foo/0") and the absolute path pointing to the image (/path/to/foo).

Does the TCF protocol API give you both fields separately? 
Then it's easy to fix this.

If all you can get from TCF "/path/to/foo/0" it looks like it's a limitation in the TCF protocol API.
Comment 5 Anna Dushistova CLA 2011-04-06 12:56:43 EDT
I think TCF only returns one(Eugene, Felix, correct me if I am wrong), but I'll double check.
Comment 6 Eugene Tarassov CLA 2011-04-06 13:12:37 EDT
I don't know how "top" and "ps" know the difference.
Processes and SysMonitor together provide pretty much all available info.
If "top" can do it, we should be able to do it too.
Comment 7 Anna Dushistova CLA 2011-05-09 09:50:33 EDT
I took a look at the procps sources and this is what I found.
Top's proc_t structure has entries for both cmdline and cmd, the latter is the basename of executable file in call to exec(2).
The first one is obtained from the /proc/<PID>/cmdline. For kernel threads like ksoftirqd/0 it is empty.
The cmd is the "name" field which is read from the /proc/<PID>/status and it is "ksoftirqd/0" in this case.
Comment 8 Martin Oberhuber CLA 2011-07-21 16:19:16 EDT
Eugene should we reassign this to TCF : Agent component based on Anna's findings?
Comment 9 Eugene Tarassov CLA 2011-07-21 16:26:29 EDT
I need to investigate. Changing "Assigned To" to myself.
Comment 10 Eugene Tarassov CLA 2011-07-25 15:19:08 EDT
"name" field of /proc/<PID>/status is same as "comm" field of /proc/<PID>/stat and same as "File" field of SysMonitor service context. Since the field already contains what we want, I have deleted the code that removes path prefix.

Fixed.