[Rt-commit] rt branch, 4.0/shredder-load-order, created. rt-4.0.15-1-g8acb3b7

Alex Vandiver alexmv at bestpractical.com
Mon Jul 29 14:54:12 EDT 2013


The branch, 4.0/shredder-load-order has been created
        at  8acb3b744ac2ecdb0b40d20b5663fb306da6eb6a (commit)

- Log -----------------------------------------------------------------
commit 8acb3b744ac2ecdb0b40d20b5663fb306da6eb6a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 29 14:19:09 2013 -0400

    Fix shredder load order in sbin/rt-shredder.in, as t/shredder/utils.pl
    
    be66534 fixed the load order in the file used to test RT::Shredder, but
    neglected to fix the execution path called by sbin/rt-shredder itself.
    Because of Shredder's unconventional load order (loading the majority of
    package via RT::Shredder's BEGIN via the RT::Shredder::RecordName
    packages -- instead via RT->Init), this causes the following:
    
        $ /opt/rt4/sbin/rt-shredder
    
        Can't locate object method "CustomFieldLookupType" via package "RT::Ticket" at /opt/rt4/sbin/../lib/RT/Tickets.pm line 1382.
        Compilation failed in require at /opt/rt4/sbin/../lib/RT/Ticket.pm line 78.
        BEGIN failed--compilation aborted at /opt/rt4/sbin/../lib/RT/Ticket.pm line 78.
        Compilation failed in require at /opt/rt4/sbin/../lib/RT/Shredder/Ticket.pm line 49.
        BEGIN failed--compilation aborted at /opt/rt4/sbin/../lib/RT/Shredder/Ticket.pm line 49.
        Compilation failed in require at /opt/rt4/sbin/../lib/RT/Shredder.pm line 230.
        BEGIN failed--compilation aborted at /opt/rt4/sbin/../lib/RT/Shredder.pm line 233.
        Compilation failed in require at /opt/rt4/sbin/rt-shredder line 138.
        BEGIN failed--compilation aborted at /opt/rt4/sbin/rt-shredder line 138.
    
    Switch to the now-standard "use RT -init" which calls RT->LoadConfig and
    RT->Init at compile-time.  This also requires the removal of
    RT::Shredder::Init, which would otherwise call them again at run-time.
    While both should be idempotent, there is no reason to do so -- the %opt
    which is stored in RT::Shredder::Init is never used, and thus the entire
    call is safe to be removed.

diff --git a/sbin/rt-shredder.in b/sbin/rt-shredder.in
index e7910e5..5164da3 100644
--- a/sbin/rt-shredder.in
+++ b/sbin/rt-shredder.in
@@ -135,7 +135,10 @@ BEGIN {
 
 }
 
-use RT::Shredder ();
+use RT -init;
+
+require RT::Shredder;
+
 use Getopt::Long qw(GetOptions);
 use File::Spec ();
 
@@ -146,7 +149,6 @@ our %plugins = RT::Shredder::Plugin->List;
 our %opt;
 parse_args();
 
-RT::Shredder::Init( %opt );
 my $shredder = RT::Shredder->new;
 
 {

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


More information about the Rt-commit mailing list