diff options
author | mkanat%bugzilla.org <> | 2009-12-01 06:33:04 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-12-01 06:33:04 +0100 |
commit | 39c30260e5427d688e8e4bdc947707de30a5e13b (patch) | |
tree | 32b3dd72041345d6cace7a56931684adf887a542 /Bugzilla | |
parent | a7508fffc4bd51b5c34620f9a9d04bf7831a0d2c (diff) | |
download | bugzilla-39c30260e5427d688e8e4bdc947707de30a5e13b.tar.gz bugzilla-39c30260e5427d688e8e4bdc947707de30a5e13b.tar.xz |
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
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Extension.pm | 9 |
1 files changed, 9 insertions, 0 deletions
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; |