]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1923778: Newer Perl hates PATH being empty (#223)
authorDave Miller <justdave@bugzilla.org>
Sat, 11 Jul 2026 05:01:19 +0000 (01:01 -0400)
committerGitHub <noreply@github.com>
Sat, 11 Jul 2026 05:01:19 +0000 (01:01 -0400)
r=mrenvoize

Bugzilla.pm

index 12d9be33f837d2d2ed410f818b26152fec8ec577..59c61e6436eab5799d5d9dfebae01d3390a37dea 100644 (file)
@@ -84,7 +84,10 @@ sub init_page {
   }
 
   if (${^TAINT}) {
-    my $path = '';
+    # PATH *MUST* contain SOMETHING or newer Perls will throw an error. Keep this
+    # minimal and platform-specific so command lookups still work when needed.
+    # see https://bugzilla.mozilla.org/show_bug.cgi?id=1923778
+    my $path = '/bin:/usr/bin';
     if (ON_WINDOWS) {
 
       # On Windows, these paths are tainted, preventing
@@ -94,12 +97,18 @@ sub init_page {
         trick_taint($ENV{$temp}) if $ENV{$temp};
       }
 
+      # Native Windows command lookup should include System32.
+      my $system_root = $ENV{SYSTEMROOT} || $ENV{WINDIR} || 'C:\\Windows';
+      trick_taint($system_root);
+      $path = "$system_root\\System32";
+
       # 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);
+        my $perl_path = dirname($^X);
+        my $c_path    = $perl_path;
         $c_path =~ s/\bperl\b(?=\\bin)/c/;
-        $path .= ";$c_path";
+        $path .= ";$perl_path;$c_path";
         trick_taint($path);
       }
     }