stas 2004/02/13 17:38:05
Modified: src/modules/perl modperl_config.c . Changes Log: Fix the corruption of the httpd process argv[0], caused by $0 manipulating Revision Changes Path 1.76 +13 -2 modperl-2.0/src/modules/perl/modperl_config.c Index: modperl_config.c =================================================================== RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -u -r1.75 -r1.76 --- modperl_config.c 12 Feb 2004 02:05:28 -0000 1.75 +++ modperl_config.c 14 Feb 2004 01:38:05 -0000 1.76 @@ -178,8 +178,19 @@ #ifdef MP_USE_GTOP scfg->gtop = modperl_gtop_new(p); #endif - - modperl_config_srv_argv_push((char *)ap_server_argv0); + + /* must copy ap_server_argv0, because otherwise any read/write of + * $0 corrupts process' argv[0] (visible with 'ps -ef' on most + * unices). This is due to the logic of calculating PL_origalen in + * perl_parse, which is later used in set_mg.c:Perl_magic_set() to + * truncate the argv[0] setting. remember that argv[0] passed to + * perl_parse() != process's real argv[0]. + * + * as a copying side-effect, changing $0 now doesn't affect the + * way the process is seen from the outside. + */ + modperl_config_srv_argv_push(apr_pstrmemdup(p, ap_server_argv0, + strlen(ap_server_argv0))); MP_TRACE_d(MP_FUNC, "new scfg: 0x%lx\n", (unsigned long)scfg); 1.330 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.329 retrieving revision 1.330 diff -u -u -r1.329 -r1.330 --- Changes 13 Feb 2004 22:32:23 -0000 1.329 +++ Changes 14 Feb 2004 01:38:05 -0000 1.330 @@ -12,6 +12,9 @@ =item 1.99_13-dev +Fix the corruption of the httpd process argv[0], caused by $0 +manipulating [Stas] + ModPerl::MethodLookup::lookup_method now handles sub-classed objects [Stas]