httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Welton <>
Subject httpd 1.3 mod_cgi argv[0]
Date Thu, 23 Jun 2005 09:23:55 GMT
[ Ok, trying this again as a subscriber... I guess the list mods missed it:-/ ]

Hi, I've managed to tickle an obscure bug in Tcl's environment
introspection by launching a 'starpack' (self contained Tcl
executable+script) as a CGI. (*)

here is the relevant bit of strace:

4763  execve("/usr/lib/cgi-bin/protect.cgi", ["protect.cgi"], [/* 25
vars */]) = 0

My question is this: why doesn't argv[0] get the full path of the
file?  It's not like the CGI can't figure it out from the cwd and the
argv0 it does get.  The Tcl folks are wondering why Apache does things
this way, and I think it's a reasonable question.  The problem for Tcl
is that it wants to know the full path of the executable, which would,
in this case, be /usr/lib/cgi-bin/protect.cgi, but it's not obvious
how to work that out from just 'protect.cgi' in a generic way.  It's
easy enough to do if you know it's a CGI, but Tcl can't contain code
just for CGI's without full-path argv0's.

David N. Welton

Apache, Linux, Tcl Consulting


David N. Welton

Apache, Linux, Tcl Consulting

View raw message