Public bug reported:

Binary package hint: libapache2-mod-perl2

PerlSetEnv does not work correctly, unless it appears after a <Perl></Perl> 
block.
This may also affect PerlPassEnv, SetEnv, or other directives.
This has been reported elsewhere on the web but no-one seems to take note.

Here's how to duplicate...

Test1 - In http.conf:

PerlModule Data::Dumper
PerlSetEnv BOB hello
<Perl>
warn Data::Dumper::Dumper(\%ENV);
</Perl>

Ok, so when we run apache2ctl configtest we get:
$VAR1 = {
          'PATH' => 
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games',
          'MOD_PERL_API_VERSION' => '2',
          'MOD_PERL' => 'mod_perl/2.0.4'
        };
Syntax OK


As you can see the environment variable BOB does not exist. So, next test...

Test2 - In http.conf:

PerlModule Data::Dumper
<Perl>

</Perl>
PerlSetEnv BOB hello
<Perl>
warn Data::Dumper::Dumper(\%ENV);
</Perl>

Note the empty <Perl></Perl> block with a blank line! (The blank line is 
important)
Ok, so when we run apache2ctl configtest we get:
$VAR1 = {
          'BOB' => 'hello',
          'PATH' => 
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games',
          'MOD_PERL_API_VERSION' => '2',
          'MOD_PERL' => 'mod_perl/2.0.4'
        };
Syntax OK


Suddenly the PerlSetEnv works! PerlSetEnv should work without the need to 
include a blank <Perl></Perl> block.
This is particularly important because scripts called with PerlRequire and 
other directives (PerlConfigRequire PerlPostConfigRequire) will NOT get the 
correct %ENV variables passed on to them.

This was tested on:
Linux ubuntu 2.6.27-9-generic (Ubuntu 8.10)
libapache2-mod-perl2 2.0.4-1ubuntu1
apache2 2.2.9-7ubuntu3

** Affects: libapache2-mod-perl2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
PerlSetEnv not working consistently in libapache2-mod-perl
https://bugs.launchpad.net/bugs/305646
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to libapache2-mod-perl2 in ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to