You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Sparling, Steve (PS, GENS)" <st...@ps.ge.com> on 2003/04/03 16:20:01 UTC

Mixed-case environment variables in Win32 don't get handled corre ctly

Hi,

Found a problem running mod_perl under Win32: (ME, 2K and XP).

Mixed-case environment variables don't get handled correctly.

They appear in the %ENV, but have no value.

I've also identified in the source where the problem is + how to fix it -
please find attached bug report.

Steve

 <<MP_ENV_WIN32>> 

Re: Mixed-case environment variables in Win32 don't get handled corre ctly

Posted by Stas Bekman <st...@stason.org>.
Sparling, Steve (PS, GENS) wrote:
> Hi,
> 
> Found a problem running mod_perl under Win32: (ME, 2K and XP).
> 
> Mixed-case environment variables don't get handled correctly.
> 
> They appear in the %ENV, but have no value.
> 
> I've also identified in the source where the problem is + how to fix it -
> please find attached bug report.

Thanks Steve. In the future please inline the report, rather attach it.

Does 'make test' pass for you?

What kind of env vars you have a problem with? Where do you set them? Or which 
ones do you expect to exist but they aren't there?

We populate %ENV with:

     modperl_env_table_populate(aTHX_ scfg->SetEnv);
     modperl_env_table_populate(aTHX_ scfg->PassEnv);

and if PerlOptions +SetupEnv (or SetHandler perl-script) are enabled:

     modperl_env_table_populate(aTHX_ r->subprocess_env);

SetEnv is already handling the upcasing. I'm not sure about PassEnv should we 
need to do the same (if so the patch below should do).

As for r->subprocess_env, doesn't httpd already does the right thing?

Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.45
diff -u -r1.45 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c	4 Apr 2003 06:03:07 -0000	1.45
+++ src/modules/perl/modperl_cmd.c	7 Apr 2003 07:23:21 -0000
@@ -223,7 +223,15 @@
  {
      MP_dSCFG(parms->server);
      char *val = getenv(arg);
-
+
+#ifdef ENV_IS_CASELESS /* i.e. WIN32 */
+    /* we turn off env magic during hv_store later, so do this now,
+     * else lookups on keys with lowercase characters will fails
+     * because Perl will uppercase them prior to lookup.
+     */
+    modperl_str_toupper((char *)arg);
+#endif
+

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org