Philippe M. Chiasson wrote:
On Wed, 2004-02-11 at 14:55 -0800, Stas Bekman wrote:

Mariano Absatz wrote:
[...]
I was trying to restore argv[0] to 'httpd', but it looks like perl does some internal magic in main(), limiting the set_magic to PL_origalen which for some reason is very short. so I get back things like 'htt' instead of 'httpd'.


I can see the problem you have reported and still looking at possible solutions.


2 things worth looking at :

ap_server_argv0 will hold the name of httpd (I hope)

And in modperl_config.c :

char **modperl_config_srv_argv_init(modperl_config_srv_t *scfg, int
*argc)
{
    modperl_config_srv_argv_push("-e;0");

that's probably why PL_origalen is set to 4, so we might need to cheat
and pad it a bit so it's at least strlen(ap_server_argv0) long...

I've found the root of the problem. $0 manipulations were corrupting process' argv[0]. it's due to how perl propogates $0 settings to argv[0]. PL_origalen
set in perl_parse, which is later used in set_mg.c:Perl_magic_set() to
truncate the argv[0] setting, is set to the length of argv[0] passed to
perl_parse(), which is not a process's real argv[0].


I've changed the code to copy the real argv[0]. so now the process is always seen from the outside with its real name (e.g. httpd), no matter what you assign to $0. The original problem was happening even if you only read $0 w/o setting it. It's truncate argv[0] to 'http' and later on to even 'htt'. My earlier patch posted in this thread tried to workaround the problem by setting
PL_origalen to the original argv[0] length, but I think detaching $0 from process' argv[0] is a goodness.


It's now committed, Marriano, please give a try to the cvs version which includes this change.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to