From: mkanat%bugzilla.org <> Date: Tue, 1 Dec 2009 05:33:04 +0000 (+0000) Subject: Bug 531107: [Windows] Starting an extension resulted in "deep recursion on subroutine... X-Git-Tag: bugzilla-3.5.3~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39c30260e5427d688e8e4bdc947707de30a5e13b;p=thirdparty%2Fbugzilla.git 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 (module owner) r=mockodin, a=mkanat --- diff --git a/Bugzilla/Extension.pm b/Bugzilla/Extension.pm index ab21eed570..793ae6043d 100644 --- a/Bugzilla/Extension.pm +++ b/Bugzilla/Extension.pm @@ -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;