[Rt-commit] rt branch 5.0/post-load-check-on-config-update updated. rt-5.0.2-261-gfea324c133

BPS Git Server git at git.bestpractical.com
Mon Jun 6 19:24:46 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/post-load-check-on-config-update has been updated
       via  fea324c133ce5006066483fdf367f4b6970f8893 (commit)
       via  037dc64e075bb1a4eae48b4d08275632a6c1d5db (commit)
      from  ba92d00faeaa42c0a621a02feab70a70ca4aaa6b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fea324c133ce5006066483fdf367f4b6970f8893
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jun 7 02:49:31 2022 +0800

    No need to update RT_SiteConfig.pm for changes in LoadConfig methods
    
    This is initially for the LoadConfigFromDatabase call from
    t/web/admin_tools_editconfig.t, which unnecessarily wrote config
    CustomFieldGroupings db update into RT_SiteConfig.pm(RT->Config->Set is
    called in PostLoadCheck of the config).

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 25d03caf06..3f0407ae0e 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -464,11 +464,14 @@ sub set_config_wrapper {
         # configuration that should be written.  This is necessary
         # because some extensions (RTIR, for example) temporarily swap
         # configuration values out and back in Mason during requests.
+
+        # No need to write configs for Set calls from LoadConfig methods
+        # like RT::Config::LoadConfigFromDatabase.
         my @caller = caller(1); # preserve list context
         @caller = caller(0) unless @caller;
 
         return RT::Config::WriteSet(@_)
-            if ($caller[1]||'') =~ /\.t$/;
+            if ( $caller[1] || '' ) =~ /\.t$/ && ( $caller[3] || '' ) !~ /LoadConfig/;
 
         return $old_sub->(@_);
     };

commit 037dc64e075bb1a4eae48b4d08275632a6c1d5db
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jun 7 03:01:48 2022 +0800

    Localize $_ for the while block in RT::Config::WriteSet added for tests
    
    $_ is not localized in while block, which could cause confusing issues:
    
        my @list = qw/foo bar/;
        for ( @list ) {
            open my $fh, '<', 'some-readable-file' or die $!;
            while ( <$fh> ) {}
        }
    
    After this, all values in @list are undef.
    
    This is the root cause of the failed tests of
    t/web/admin_tools_editconfig.t in ba92d00fae.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 6cfb965443..25d03caf06 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -420,7 +420,7 @@ sub set_config_wrapper {
         open( my $fh, '<', $tmp{'config'}{'RT'} )
             or die "Couldn't open config file: $!";
         my @lines;
-        while (<$fh>) {
+        while (local $_ = <$fh>) {
             if (not @lines or /^Set\(/) {
                 push @lines, $_;
             } else {

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

Summary of changes:
 lib/RT/Test.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list