Item11384: $Foswiki::cfg
references in other config variables not expanded within web Extensions installer
Priority: Urgent
Current State: Closed
Released In: 1.1.5
Target Release: patch
Applies To: Engine
Component: Configure
Branches: Release01x01 trunk
I just upgraded from 1.1.3 to 1.1.4, and upon trying to upgrade plugins (not
KinoSearchContrib), I was met with this error:
Logfile cannot be opened at $Foswiki::cfg{WorkingDir}/work_areas/KinoSearchContrib/logs/update-20111222.log. at /data/www/vhosts/test.foswiki.science.unsw.edu.au/Foswiki/lib/Foswiki/Contrib/KinoSearchContrib/KinoSearch.pm line 52.
I added some debug messages and eventually tracked it down to the
LogDirectory setting (which hasn't changed) '$Foswiki::cfg{WorkingDir}/work_areas/KinoSearchContrib/logs'
I modified
KinoSearchContrib as follows:
sub logDirName {
my $log = $Foswiki::cfg{KinoSearchContrib}{LogDirectory};
# by calling, we know it will be created
my $work_area = Foswiki::Func::getWorkArea('KinoSearchContrib');
die "$!: $work_area" if !-d $work_area;
if ( !$log ) {
$log = "$work_area/logs";
}
unless ( -d $log ) {
mkdir( $log, 0777 ) or die "ok: $work_area\n$!: $log";
}
die "$!: $log" if !-d $log;
return $log;
}
--
JayenAshar - 22 Dec 2011
appears the same for
IndexDirectory:
Can't open invindex location '$Foswiki::cfg{WorkingDir}/work_areas/KinoSearchContrib/index': No such file or directory at /data/www/vhosts/test.foswiki.science.unsw.edu.au/Foswiki/lib/../../cpan/lib/perl5/i586-linux-thread-multi/KinoSearch1/Store/FSInvIndex.pm line 79
--
JayenAshar - 22 Dec 2011
my current workaround seems to be to blank out both settings and rebuild the index...
--
JayenAshar - 22 Dec 2011
rebuilt the index because i got this error:
read_bytes: tried to read 1 bytes, got 0 at /data/www/vhosts/test.foswiki.science.unsw.edu.au/Foswiki/lib/../../cpan/lib/perl5/i586-linux-thread-multi/KinoSearch1/Index/NormsReader.pm line 33
--
JayenAshar - 22 Dec 2011
LocalSite.cfg is accessed in two different paths. One used by configure and things running under control of configure, does not expand config variable references. (Otherwise saving the configuration would remove all of the references). When run outside of configure, the Config variables are all expanded during load using
Foswiki::Configure::Load::expandValue(some_variable)
.
In locations where code running under configure requires an expanded variable, the above function will expand the variable "in-place" so it's important to copy the variable to a working variable, and then call the expandValue function on it. This is used in the Configure/Checkers when they have to check the ultimate path of a variable.
I don't have any of these extensions installed, and I'm not sure why a contrib code should be being executed at all during configure.
--
GeorgeClark - 22 Dec 2011
I think I have a simple fix to configure. In the
_actionManageExtensions
routine, it needs to reload the foswiki configuration, so that the variables all expand.
I have not been able to completely recreate the environment to get these failures, so please test this if possible and post feedback.
diff --git a/core/bin/configure b/core/bin/configure
index 29bafe8..6361125 100755
--- a/core/bin/configure
+++ b/core/bin/configure
@@ -772,6 +772,10 @@ sub _actionManageExtensions {
_screenAuthorize( 'EXTEND', $messageType );
}
else {
+
+ delete $Foswiki::cfg{ConfigurationFinished};
+ Foswiki::Configure::Load::readConfig();
+
my $html = Foswiki::Configure::UI::getTemplateParser()
->readTemplate('pagebegin');
Foswiki::Configure::UI::getTemplateParser()->parse( $html, {} );
--
GeorgeClark - 22 Dec 2011
That seems to work for this problem. Thanks.
--
JayenAshar - 23 Dec 2011
I seem to be having a similar problem with my kino search - getting the error
"read_bytes: tried to read 4 bytes, got 0"
whenever I run a kinosearch. Seems like you guys know how to fix this, but it all seems a little over my head. Can you guide me on where to go to get this done?
--
WilliamMorgan - 16 Nov 2012
try rebuilding the kinoindex.
--
JayenAshar - 16 Nov 2012