Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313719

Summary: Reference agent: argv[0] is missing in the execve() for Processes.start command
Product: [Tools] TCF Reporter: Lianhao Lu <lianhao.lu>
Component: CoreAssignee: Project Inbox <dsdp.tm.tcf-inbox>
Status: RESOLVED INVALID QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, eugene
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

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.