Forum OpenACS Q&A: Error on StaticPages filesystem search

Collapse
Posted by tammy m on
I just installed Static Pages. The first time I run the filesystem scan for static pages, after restarting nsd, I get an error that nsv array 'sp_sync_cr_fs_times' does not exist!.

If I run this a second time (without restarting nsd) then it works fine. However, if I restart nsd, the first time I run the filesystem scan, I get the same behavior.

Looking at the use of sp_sync_cr_fs_times in static-pages-init.tcl and static-pages-procs.tcl, it seems related to the testing for existence of the nsv_array itself.

I wrote a very simple test of this and found some weird results. I am very new to tcl and aolserver. Am I misunderstanding the basic use of the nsv_array exists function? Here is how I tried to verify existence of an nsv_array:

set nsv {tmmsp_sync_cr_fs_times}ns_write "FOO-TMM.tcl declared tmmsp_sync_cr_fs_times.
" nsv_unset $nsv ns_write "FOO-TMM.tcl SET array $nsv.
" nsv_array set $nsv [list] if { ![nsv_array exists $nsv] } { ns_write "FOO-TMM.tcl nsv_array $nsv does NOT exist.
" } else { ns_write "FOO-TMM.tcl nsv_array $nsv DOES exist.
" } ns_write "FOO-TMM.tcl SET KEY for array $nsv.
" nsv_set $nsv foo 1 if { ![nsv_array exists $nsv] } { ns_write "FOO-TMM.tcl nsv_array $nsv does NOT exist.
" } else { ns_write "FOO-TMM.tcl nsv_array $nsv DOES exist.
" }

Anyway, it appears to me that the nsv_array doesn't appear to exist until a key is set in the array itself??

Collapse
Posted by Andrew Piskorski on
Tammy, exactly what versions of OpenACS and AOLserver are you using?

I wrote that bit of Static Pages code that seems to be giving you trouble, and in my experience (at least on AOLserver 3.3+ad13), this code:

nsv_array set $nsv [list]
does always create an empty nsv. If that is not the case on some other version of AOLserver or something, then I'll want to track down why and do something about it...

Collapse
Posted by tammy m on
Hi

Sorry I shoulda mentioned that I'm on OACS 4.6.1 tarball and AOLserver 4.0beta4.

Collapse
Posted by Andrew Piskorski on
Tammy, I tested both AOLserver 4.0 beta 2 and beta 4, the behavior of empty nsvs has definitely changed since AOLserver 3.x, probably unintentionally. I've submitted a bug on SorceForge.

In the meantime, you can probably get Static Pages to work correctly with AOLserver 4.0 by just editing packages/static-pages/tcl/static-pages-init.tcl and changing the "nsv_array set $nsv" line to this:

#nsv_array set $nsv [list]
nsv_set $nsv dummy_AOLsever4beta4_key {}

Collapse
Posted by tammy m on
Thanks Andrew. I thought I was really not understanding Tcl code there! I was able to get Static Pages working with code just like what you sent me:)