[Rt-commit] rt branch, 4.2/crontool-module-load, created. rt-4.2.6-11-g625e7b9

Alex Vandiver alexmv at bestpractical.com
Thu Jul 17 11:37:35 EDT 2014


The branch, 4.2/crontool-module-load has been created
        at  625e7b99c99767f2cc2314a1411fe0cd1cd74238 (commit)

- Log -----------------------------------------------------------------
commit 625e7b99c99767f2cc2314a1411fe0cd1cd74238
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Apr 18 18:51:04 2014 -0400

    Failure to store $@ immediately causes wrong diagnostics to be printed
    
    Passing $@ to loc() causes its value to not be examined until later,
    when it is substituted into the string.  Between the ->require error and
    then, the loc() machinery attempts to run for the first time, which
    _also_ requires files, thus overwriting the original error in $@.
    
    Store the error found in $@ away into a different variable, to ensure
    that it is not lost before it is used.  Passing "$@" instead of $@ would
    similarly suffice, but the clarity of the extra variable is preferrable.
    
    Fixes I#22991.

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 668b325..76dac0d 100644
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -288,7 +288,8 @@ sub get_template {
 sub load_module {
     my $modname = shift;
     unless ($modname->require) {
-        die loc( "Failed to load module [_1]. ([_2])", $modname, $@ );
+        my $error = $@;
+        die loc( "Failed to load module [_1]. ([_2])", $modname, $error );
     }
 
 }

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


More information about the rt-commit mailing list