Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313719 - Reference agent: argv[0] is missing in the execve() for Processes.start command
Summary: Reference agent: argv[0] is missing in the execve() for Processes.start command
Status: RESOLVED INVALID
Alias: None
Product: TCF
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-20 09:06 EDT by Lianhao Lu CLA
Modified: 2011-05-17 10:50 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lianhao Lu CLA 2010-05-20 09:06:45 EDT
Typically, in a C program, the main function gets its argv[0] paramter as its program name. The reference agent uses execve(exec, args, envp) system call to process the Processes.start command. But it doesn't set the first element of the args array to the application name.

Sending the following JSON to agent would results the "./foo" application getting argc=2, argv[0]="-arg1", argv[1]="-arg2". Not the argc=3, argv[0]="./foo", argv[1]="-arg1", argv[2]="-arg2" as it expects. This could cause some application reporting parameter error.

C <token> Processes start "/home" "./foo" ["arg1","arg2"] [] false
Comment 1 Lianhao Lu CLA 2010-05-20 09:20:43 EDT
This kind of missing argv[0] would cause "/bin/ls" behave abnormally.
Comment 2 Eugene Tarassov CLA 2010-05-20 14:44:21 EDT
Yes, the service does not add process image filename as argv[0]. It is intensional.

While argv[0] should point to a filename that is associated with the process being started, it is not always same as process image filename, which can instead point to a shell or interpreter.

Correct way to start /bin/ls is:

Processes start "/home" "/bin/ls" ["/bin/ls","arg1","arg2"] [] false

I have updated docs to reflect that.
Comment 3 Doug Schaefer CLA 2011-05-17 10:50:51 EDT
Moving bugs to new home for IP log.