[Lxr-commits] CVS: lxr/lib/LXR Common.pm, 1.102, 1.103 Config.pm, 1.55, 1.56
Brought to you by:
ajlittoz
From: Andre-Littoz <ajl...@us...> - 2013-01-11 17:35:54
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24257/lib/LXR Modified Files: Common.pm Config.pm Log Message: Common.pm, Config.pm: improve error handling condition New method emergency in Config to tentatively recover from a "virtroot not found" error and print some user-friendly message Index: Common.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Common.pm,v retrieving revision 1.102 retrieving revision 1.103 diff -u -d -r1.102 -r1.103 --- Common.pm 14 Nov 2012 15:22:57 -0000 1.102 +++ Common.pm 11 Jan 2013 17:35:51 -0000 1.103 @@ -865,6 +865,7 @@ $config = LXR::Config->new($script_path); unless (defined $config) { + $config = LXR::Config->emergency($script_path); LXR::Template::makeerrorpage('htmlfatal'); die "Can't find config for " . $HTTP->{'this_url'}; } @@ -901,8 +902,12 @@ # on a directory name. $pathname = $HTTP->{'path_info'}; $releaseid = clean_release($config->variable('v')); + $releaseid =~ m/(.*)/; + $releaseid = $1; # untaint for future use $config->variable('v', $releaseid); # put back into config obj $pathname = fixpaths($HTTP->{'path_info'}); + $pathname =~ m/(.*)/; + $pathname = $1; # untaint for future use printhttp; } Index: Config.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Config.pm,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- Config.pm 14 Nov 2012 15:22:57 -0000 1.55 +++ Config.pm 11 Jan 2013 17:35:51 -0000 1.56 @@ -70,6 +70,25 @@ } +=head2 C<emergency ()> + +Method C<emergency> returns whatever can be retrieved from +the configuration file. + +It is intended to allow editing user-friendly error message when +a catastrophic event occurred during initialisation. + +=cut + +sub emergency { + my ($class, @parms) = @_; + my $self = {}; + bless($self); + $self->_initialize(@parms); + return ($self); +} + + =head2 C<readconfig ()> Method C<readconfig> returns the content of the configuration |