[Rt-commit] rt branch, 4.0/dotless-inc-path, created. rt-4.0.24-36-g0c62822

Alex Vandiver alexmv at bestpractical.com
Fri Aug 5 02:46:48 EDT 2016


The branch, 4.0/dotless-inc-path has been created
        at  0c628220bf8d5d373992952eed85ce1f4871a337 (commit)

- Log -----------------------------------------------------------------
commit 0c628220bf8d5d373992952eed85ce1f4871a337
Author: Alex Vandiver <alex at chmrr.net>
Date:   Thu Aug 4 23:29:29 2016 -0700

    Pass a fully-qualified path when requiring RT::Generated
    
    As the comments a few lines down note, `$INC{'RT.pm'}` is not
    guaranteed to be absolute.  By examining the path used by RT.pm, and
    passing that to `require`, RT was attempting to skip the search of
    @INC -- however, a relative path always searches @INC.
    
    But the only means to find `lib/RT/Generated.pm` in @INC, in most
    installs, is if the CWD is the root of an RT install, and @INC
    contains `.`.  (Un)fortunately, perl's @INC nearly always was compiled
    to contain `.` -- until CVE-2016-1238.
    
    In response, many versions of perl now omit trailng `.` directories from
    @INC, on a conditional or absolute basis.  Combined with the above,
    this leads to failure to find RT::Generated.
    
    Make the path passed to `require` always be absolute, to skip @INC
    dependence entirely.

diff --git a/lib/RT.pm b/lib/RT.pm
index 744ee6c..b1f081c 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -758,6 +758,7 @@ sub InstallMode {
 sub LoadGeneratedData {
     my $class = shift;
     my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
+    $pm_path = File::Spec->rel2abs( $pm_path );
 
     require "$pm_path/RT/Generated.pm" || die "Couldn't load RT::Generated: $@";
     $class->CanonicalizeGeneratedPaths();

-----------------------------------------------------------------------


More information about the rt-commit mailing list