]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 531107: [Windows] Starting an extension resulted in "deep recursion on subroutine...
authormkanat%bugzilla.org <>
Tue, 1 Dec 2009 05:33:04 +0000 (05:33 +0000)
committermkanat%bugzilla.org <>
Tue, 1 Dec 2009 05:33:04 +0000 (05:33 +0000)
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) r=mockodin, a=mkanat

Bugzilla/Extension.pm

index ab21eed57035f6a823826df6dfc16e084b47a15e..793ae6043d590f8deaac79ff544ffaf8cb14d844 100644 (file)
@@ -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;