Opened 6 years ago

Closed 5 years ago

#307 closed defect (fixed)

argv[0] of shell script interpreter

Reported by: KO Myung-Hun Owned by:
Priority: normal Milestone: libc-0.6.6
Component: libc-backend Version: 0.6.5
Severity: normal Keywords:
Cc:

Description

Hi/2.

argv[0] should be a program itself. However, if spawn() a shell script, the script name is passed to a shell. So the shell using argv[0] misbehave.

I attach test programs. If you run spawn_arg.exe, then you can confirm argv[0] is a shell script not a shell.

Attachments (2)

spawn_arg.zip (4.7 KB) - added by KO Myung-Hun 6 years ago.
sample programs
__spawnve_arg0.diff (1.1 KB) - added by KO Myung-Hun 6 years ago.
patch for argv[0] problem

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by KO Myung-Hun

Attachment: spawn_arg.zip added

sample programs

Changed 6 years ago by KO Myung-Hun

Attachment: __spawnve_arg0.diff added

patch for argv[0] problem

comment:1 Changed 5 years ago by bird

Thanks for the testcase. Don't know where I got the weird ideas for that list of parameter to the interpreter from... Anyway, r3930 does a better job, though I suspect it shouldn't really do an _realrealpath on the script name.

comment:2 Changed 5 years ago by bird

Component: libclibc-backend
Milestone: libc-0.7libc-0.6.6
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.