[Rt-devel] inaccurate error message when the core config file is missing

Nicholas Clark nick at ccl4.org
Mon May 14 10:14:28 EDT 2007


When the core config file is missing, currently the error message is plain
wrong:

$ perl -Ilib bin/standalone_httpd 8080
Use of uninitialized value in getpwuid at lib/RT.pm line 154.
Use of uninitialized value in getgrgid at lib/RT.pm line 155.
Couldn't load RT config file %s as user nick / group nick.
The file is owned by user %s and group %s.
This usually means that the user/group your webserver is running as cannot read the file.
Be careful not to make the permissions on this file too liberal, because it contains database
passwords.  You may need to put the webserver user in the appropriate group (%s) or change
permissions be able to run succesfully '/opt/rt3/etc/RT_Config.pm'
Can't locate /opt/rt3/etc/RT_Config.pm in @INC (@INC contains: /opt/rt3/local/lib /opt/rt3/lib lib /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at lib/RT.pm line 151.
BEGIN failed--compilation aborted at bin/standalone_httpd line 55.

With this patch, at least it's now only mildly inaccurate:

$ perl -Ilib bin/standalone_httpd 8080
Use of uninitialized value in getpwuid at lib/RT.pm line 165.
Use of uninitialized value in getgrgid at lib/RT.pm line 166.

RT couldn't load RT config file /opt/rt3/etc/RT_SiteConfig.pm as:
    user: nick
    group: nick

The file is owned by user root and group wheel.

This usually means that the user/group your webserver is running
as cannot read the file.  Be careful not to make the permissions
on this file too liberal, because it contains database passwords.
You may need to put the webserver user in the appropriate group
(wheel) or change permissions be able to run successfully.
 '/opt/rt3/etc/RT_Config.pm'
Can't locate /opt/rt3/etc/RT_Config.pm in @INC (@INC contains: /opt/rt3/local/lib /opt/rt3/lib lib /usr/local/lib/perl5/5.8.8/BSDPAN /usr/local/lib/perl5/site_perl/5.8.8/mach /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.8/mach /usr/local/lib/perl5/5.8.8 .) at lib/RT.pm line 162.
BEGIN failed--compilation aborted at bin/standalone_httpd line 57.


I'm not sure of the best way to implement the message to also cope with
"file is missing". Suggestions?

Nicholas Clark

Index: lib/RT.pm.in
===================================================================
--- lib/RT.pm.in	(revision 7852)
+++ lib/RT.pm.in	(working copy)
@@ -144,7 +144,7 @@
 as cannot read the file.  Be careful not to make the permissions
 on this file too liberal, because it contains database passwords.
 You may need to put the webserver user in the appropriate group
-(%s) or change permissions be able to run succesfully.
+(%s) or change permissions be able to run successfully.
 EOF
 
 
@@ -166,7 +166,7 @@
         my $filegroup = getgrgid($filegid);
         my $errormessage = sprintf($message, $SITE_CONFIG_FILE,
                                    $fileusername, $filegroup, $filegroup);
-        die ("$message '$CORE_CONFIG_FILE'\n$@") 
+        die ("$errormessage '$CORE_CONFIG_FILE'\n$@") 
     }
 
     # RT::Essentials mistakenly recommends that WebPath be set to '/'.


More information about the Rt-devel mailing list