diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2015-09-30 20:27:44 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2015-09-30 20:27:44 +0200 |
commit | 9cd7cb75046ae91f7dc7a3977b8d85886227a2b7 (patch) | |
tree | 88d4e83d0490d2dc9581c3e5ff70a3a4386cb7de | |
parent | a326cd5545b36f7a59e1912494959a0932250263 (diff) | |
download | bugs-9cd7cb75046ae91f7dc7a3977b8d85886227a2b7.tar bugs-9cd7cb75046ae91f7dc7a3977b8d85886227a2b7.tar.gz bugs-9cd7cb75046ae91f7dc7a3977b8d85886227a2b7.tar.bz2 bugs-9cd7cb75046ae91f7dc7a3977b8d85886227a2b7.tar.xz bugs-9cd7cb75046ae91f7dc7a3977b8d85886227a2b7.zip |
Bug 987742: Strawberry Perl requires C:\strawberry\c\bin\ to be in $ENV{PATH} to correctly load XS modules
r=gerv a=dkl
-rw-r--r-- | Bugzilla.pm | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm index 3f4d31101..aa78f1483 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -82,19 +82,27 @@ sub init_page { } if (${^TAINT}) { - # Some environment variables are not taint safe - delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; - # Some modules throw undefined errors (notably File::Spec::Win32) if - # PATH is undefined. - $ENV{'PATH'} = ''; - # On Windows, these paths are tainted, preventing File::Spec::Win32->tmpdir - # from using them. But we need a place to temporary store attachments - # which are uploaded. + my $path = ''; if (ON_WINDOWS) { + # On Windows, these paths are tainted, preventing + # File::Spec::Win32->tmpdir from using them. But we need + # a place to temporary store attachments which are uploaded. foreach my $temp (qw(TMPDIR TMP TEMP)) { trick_taint($ENV{$temp}) if $ENV{$temp}; } + # Some DLLs used by Strawberry Perl are also in c\bin, + # see https://rt.cpan.org/Public/Bug/Display.html?id=99104 + if (!ON_ACTIVESTATE) { + my $c_path = $path = dirname($^X); + $c_path =~ s/\bperl\b(?=\\bin)/c/; + $path .= ";$c_path"; + } } + # Some environment variables are not taint safe + delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; + # Some modules throw undefined errors (notably File::Spec::Win32) if + # PATH is undefined. + $ENV{'PATH'} = $path; } # Because this function is run live from perl "use" commands of |