Commit 39c30260 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 531107: [Windows] Starting an extension resulted in "deep recursion on…

Bug 531107: [Windows] Starting an extension resulted in "deep recursion on subroutine" because File::Spec::Win32 was doing a "require" in case_tolerant, which recursed into Bugzilla::Extension::my_inc in an infinite loop. Patch by Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) r=mockodin, a=mkanat
parent a7508fff
......@@ -154,10 +154,19 @@ sub modify_inc {
# This is what gets put into @INC by modify_inc.
sub my_inc {
my ($class, undef, $file) = @_;
# This avoids infinite recursion in case anything inside of this function
# does a "require". (I know for sure that File::Spec->case_tolerant does
# a "require" on Windows, for example.)
return if $file !~ /^Bugzilla/;
my $lib_dir = __do_call($class, 'lib_dir');
my @class_parts = split('::', $class);
my ($vol, $dir, $file_name) = File::Spec->splitpath($file);
my @dir_parts = File::Spec->splitdir($dir);
# File::Spec::Win32 (any maybe other OSes) add an empty directory at the
# end of @dir_parts.
@dir_parts = grep { $_ ne '' } @dir_parts;
# Validate that this is a sub-package of Bugzilla::Extension::Foo ($class).
for (my $i = 0; $i < scalar(@class_parts); $i++) {
return if !@dir_parts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment