Messages in this thread | | | From | "Khimenko Victor" <> | Date | Thu, 17 Feb 2000 04:17:53 +0300 (MSK) | Subject | Re: #! and argv[0]: the path is removed before invoking the interpreter |
| |
In <200002170053.QAA23564@ultra.franz.com> Kevin Layer (layer@franz.com) wrote: >>> In <E12LBjK-0000Xp-00@the-village.bc.nu> Alan Cox (alan@lxorguk.ukuu.org.uk) wrote: >>> >> I believe the behavior of #! on Solaris goes all the way back to BSD >>> >> in of the early 80's. FreeBSD 3.0 behaves as Solaris does. >>> >> >>> >> I hope this considered a bug. If there willingness to take a patch for >>> >> it, I might work on making the fix. >>> >>> > Im not sure about bug, but its certainly worth behaving the same way as >>> > everyone else in this case if its appropriate to do so. Take a look at >>> > the fs/binfmt* code and sure - send a patch >>> >>> IMO it's better be CONSISTENT. Either >>> 1) argv[0] is always the same thing that was passed to execv >>> or >>> 2) argv[0] is always "realpath" to executable.
KL> The patch that I sent out does (1). That is, whatever interpreter is KL> given on the #! is given to execve(), and that is stuck into argv[0]. KL> If it is a relative pathname, then that's what it is. I have KL> personally never seen #! scripts that use a relative pathname.
I've seen such scripts :-) In perl distribution (there are exist scripts to test perl BEFORE installation; since it's not clear where perl will be installed in the end there are used just #!../perl :-)
>>> Since in case of "real binary" we doing 1) IMNSHO we should do this in case >>> of script as well...
P.S. Since code to strip path out was ADDED not just "it was done this way since so happened and no one really cared" it's interesting to find out who and why added it....
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |