Hi Massimo,

yes, you are right it, we are upgrading from an ooold 'mod_dtcl' application to rivet. :-)

We registered ttml also as rivet type:

    AddType application/x-httpd-rivet .ttml
    AddType application/x-httpd-rivet .rvt

So nothing changes by changing the name.
BTW: Is there another difference to become/being a rvt file?

The code is already executed in the right directory. So 'puts [pwd]' gives the correct (intended) directory. But your proposal to explicitly determine the path helps, e.g. for handleBBB.ttml:

<?
source [file join  [info dirname [info script]] include.tcl]
?>

But what is the reason for failing with the relative pathname? The TCL version, Rivet? I assume both - a little bit each. I would prefer to know why the code does not work as expected. I observed also some other "oddities". (But this may also come from a wrong TCL understanding. May be I come later back with these.)

BTW: Unfortunately to upgrade to 8.4 is no option in the moment. The decision is already done. :-(

Best regards
Sven



Massimo wrote:
Hi Sven

your application looks like it's based on mod_dtcl rather than a pure
Rivet one.
I hope David is on-line and reading list, he might have a quick
answer. Can
you reproduce the same problem with .rvt files? I suggest also you
devise a
way to exactly determine the path to the file to be included.

you
may force Tcl to include a file in BBB by telling to 'include' the path
relative
to the parent dir (provided [pwd] returns the BBB's parent dir)

in
handleBBB.ttml:
<?
include [file join  [info dirname [info script]] include.
tcl]
?>

if you want to be sure you may normalize the path to a full path

set
fullpath [file normalize [file join [info dirname [info script] include.tcl]]


include $fullpath

I haven't checked this code but this is an idea of how I
proceed in
these cases

You may check from which directory your requests are
being processed by
logging (apache_log_error) or printing the output of the
'cmd' command
(puts "<pre>[pwd]</pre>").

  -- Massimo

P.S. Even though Rivet
2.0.4 basic commands should work with Tcl 8.4 I
recommend Tcl 8.5 and, anyway
I suggest you move to .rvt files


----Messaggio originale----
Da:
svenk...@online.de
Data: 16-gen-2012 11.08
A:<rivet-dev@tcl.apache.org>
Ogg:
Weird file mis-selection problem

Hello list-listeners,

at first thank you all
for providing Rivet.

We have a weird problem and I hope you can help: The Tcl

interpreter/Rivet is selecting the wrong (sourced) file depending on a

previously executed request. If you have files with the same name but
within
different directories it may happen that the wrong code is
executed if these
files are sourced.

I don't know if Rivet or TCL is the reason for the problem.
I've running
rivet 2.0.4 with Tcl 8.4.19 within Apache 2.2.17.
RivetServerConf
CacheSize is already set to 0.

I've tried to simplify the
problem as most as possible - I have two
different directories containing Tcl
scripts:
* AAA/handleAAA.ttml
* AAA/include.ttml
* BBB/handleBBB.ttml
*
BBB/include.ttml

handleBBB.ttml is simply sourcing the include.tcl
<?
source
include.tcl
?>

Both include.tcl are putting some messages on stdout. Only

handleAAA.ttml has some procedures with some commands (it is the
remainder of
a more comprehensive file):
<?
#hgetvars
set myVARS(aParam) XYZ

proc procA {}
{
      upvar myVARS(some_unused) some_unused_inner
      set args {}
      regsub
astring $args globalvar_local args
}

proc procB { } {
      upvar myVARS myVARS

      set unused_param $myVARS(aParam)
      source include.tcl
      procA
}


procB

?>
(If you want I can provide you the complete code for all files.)

If
there are multiple Apache instances listening on one port I loop
through it
doing multiple requests, e.g.:
for i in {1..10} ; do wget -O- -q -S
"http://localhost/sventemp/AAA/handleAAA.ttml ; done
for i in {1..10} ; do
wget -O- -q -S
"http://localhost/sventemp/BBB/handleBBB.ttml ; done

In the end I can see
that there are some requests are processed as
expected, others not. This
depends on which request was executed
previously by the specific instance.


The only way I've found to circumvent the faulty behavior is to set the
option
"MaxRequestsPerChild 1".
Does anyone see other options?

What is the cause of
this behavior? Is it a bug?

Your help is very much appreciated.
Sven







---------------------------------------------------------------------
To
unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional
commands, e-mail: rivet-dev-h...@tcl.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to