Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.ForkExec argv0 has to be provided twice #428

Closed
hoisie opened this issue Dec 15, 2009 · 2 comments
Closed

os.ForkExec argv0 has to be provided twice #428

hoisie opened this issue Dec 15, 2009 · 2 comments

Comments

@hoisie
Copy link
Contributor

hoisie commented Dec 15, 2009

What steps will reproduce the problem?
1. Run this code: http://pastie.org/743753

What is the expected output? What do you see instead?
I expect "1 2 3", but I get "2 3"

What is your $GOOS?  $GOARCH?
linux/386

Which revision are you using?  (hg identify)
a33ae1785d42+ (+=�=<) tip

Please provide any additional information below.
The ForkExec call is weird because it seems like you have to repeat argv0 -
- both as the first argument to ForkExec, and as the first item in the list 
argv. Couldn't ForkExec just prepend argv0 to the args list before making 
the syscall?
@rsc
Copy link
Contributor

rsc commented Dec 15, 2009

Comment 1:

This is a standard Unix interface issue.
The binary being run does not need to be argv[0].
It really is its own command line option.
For example, when login runs /bin/sh it
traditionally sets argv[0] to "-sh" to denote
that this is a login shell.

Owner changed to r...@golang.org.

Status changed to WontFix.

@hoisie
Copy link
Contributor Author

hoisie commented Jan 27, 2010

Comment 2:

Someone else ran into this issue:
http://stackoverflow.com/questions/2148190/exec-run-and-argv-problem/2148797#2148797
I still believe it's confusing. Most people don't expect to pass the program name with 
the args

@hoisie hoisie added the wontfix label Jan 27, 2010
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants