From 39c30260e5427d688e8e4bdc947707de30a5e13b Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 1 Dec 2009 05:33:04 +0000 Subject: 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 --- Bugzilla/Extension.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Bugzilla/Extension.pm') diff --git a/Bugzilla/Extension.pm b/Bugzilla/Extension.pm index ab21eed57..793ae6043 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; -- cgit v1.2.3-24-g4f1b