[Rt-commit] rt branch, 4.4/warn-site-config-permission, created. rt-4.4.2-77-g7f679f5e8

? sunnavy sunnavy at bestpractical.com
Fri Feb 23 08:52:49 EST 2018


The branch, 4.4/warn-site-config-permission has been created
        at  7f679f5e840145b91aeec2b2dd2ccc3b21e1517a (commit)

- Log -----------------------------------------------------------------
commit 7f679f5e840145b91aeec2b2dd2ccc3b21e1517a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Feb 23 21:30:49 2018 +0800

    warn if it's permission that prevents site configs from being loaded.
    
    For core configs like RT_Config.pm, RT dies with a long message if there
    is a permission issue. But for *optional* site configs, RT simply
    ignores if they can't be loaded, because usually it means the site
    configs don't exist.
    
    Since perl 5.18, the "Can't locate ..." message has been improved so we
    can tell if there is a permission issue. Thus, we can easily warn people
    if a permission issue is found, since it's most likely a configuration
    issue.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index e73273012..f775ea5d1 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1338,7 +1338,15 @@ sub _LoadConfig {
         }
     };
     if ($@) {
-        return 1 if $is_site && $@ =~ /^Can't locate \Q$args{File}/;
+
+        if ( $is_site && $@ =~ /^Can't locate \Q$args{File}/ ) {
+
+            # Since perl 5.18, the "Can't locate ..." error message contains
+            # more details. warn to help debug if there is a permission issue.
+            warn qq{Couldn't load RT config file $args{'File'}:\n\n$@} if $@ =~ /Permission denied at/;
+            return 1;
+        }
+
         if ( $is_site || $@ !~ /^Can't locate \Q$args{File}/ ) {
             die qq{Couldn't load RT config file $args{'File'}:\n\n$@};
         }

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


More information about the rt-commit mailing list