You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <ma...@unipr.it> on 2007/10/26 00:18:31 UTC

rivetlib, directory config and exit handler

First of all I apologize for this lengthy message
but I stacked quite a few things to talk about.

I've been working on a few problems that I thought had to
be fixed or at least tested. 
I want to make public on the list what I'm doing, 
before I pursue goals that are not shared or maybe 
are being addressed by Valery independently.

I've already expressed my opinion about rivet's tcl
procedures: I think they should end up in a directory 
specific to a release following the scheme already 
adopted in 1_0: ie to append the version number as suffix
to the target directory. The advantages are clear if 
someone (like me) is running 2 instances of apache.

I patched configure.ac and Makefile.am for this purpose: 
the install mechanism is working as expected and a new  
preprocessor symbol (RIVETLIB_DESTDIR) with the 
target directory gets defined in config.h, but
what is the most proper way for telling Tcl_PkgRequire 
to load the right init.tcl? 
Manipulating 'auto_path' in Rivet_PerInterpInit prepending
RIVETLIB_DESTDIR as first element in the list before
'package requiring' Rivetlib would make unnecessary doing
it at the Tcl level in Rivetlib::Init. 
The only other method I can imagine
is to run Tcl_EvalFile on the init.tcl using the 
preprocessor macro to determine the path. 
The more I think of this the less I like it. 
David I'm sure you have thoughts about this.

Rivet_GetConf had lines of code for merging server and
directory configurations. It shouldn't. 
Actually the merge code was shunned away
by an unconditioned 'return' but anyway for
the merging Apache has its own methods defined in
the module descriptor. I commented away the 
spurious code and tested the merging on a few page. 
It seems to work.

I tried also to reintroduce the exit handler which
was excluded. I think the child handler has a bug 
when called upon child exit: in fact as Jeff Hobbs
highlighted on this list in the past, interpreters
must be deleted before Tcl_Finalize is called. I'm
testing this patch and I had no crashes for now.

again sorry for the bulky message. Have a nice
weekend.

 -- Massimo



--
Universita' degli Studi di Parma (http://www.unipr.it)


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


Re: rivetlib, directory config and exit handler

Posted by Massimo Manghi <ma...@unipr.it>.
I'm sending the patches for configure.ac (which introduces the 
--with-rivet-target-dir
switch for changing the rivet tcl library destination directory), 
mod_rivet.c
with the changes I described in my previous message and Makefile.am for 
handling
the new variable defined in configure.

comments absolutely welcome (and necessary, I think)

 --Massimo


Valery Masiutsin wrote:
> Hello, Massimo !
>
> Hm would you like to point me to the conversations about exit handlers ?
> How much time ago that was happened ?
> I am working on replacing libapreq bits with their libapreq2 equivalents now
> (apache_* files),  API has been changed significantly (totally ?), so
> i presume it will take another week or even two. BTW those tests
> helped me a lot.
>
> Regards Valery
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: rivet-dev-help@tcl.apache.org
>
>   


Re: rivetlib, directory config and exit handler

Posted by Massimo Manghi <ma...@unipr.it>.
David Welton wrote:
> Sorry for the slow response... had some messiness with work, and guests.
>
>   
>> src/apache-2/mod_rivet.c: during the per-interpreter
>> initialization 'init.tcl' is run by calling
>> Tcl_EvalFile on it.
>> The path to init.tcl is obtained from RIVETLIB_DESTDIR,
>> whose definition is in Makefile.am. I also changed
>> src/Makefile.am to reflect this. RIVETLIB_DESTDIR
>> is defined by substitution of the variable
>> RIVET_TCL_TARGET (see macro rivet_target_dir in
>> configure.ac). Perhaps it's suboptimal, but I only
>> recently started to write m4 macros for the autotools.
>> The exit handler was re-enabled and Tcl_DeleteInterp
>> called upon child exit.
>>     
>
> The apache-1 patch I see is related to init.tcl.  I forget exactly how
> things work, but should we be using the PkgRequire instead of sourcing
> init.tcl ?
>   
Di David, thank you for pointing this out. In fact the solution is
an overkill of the problem. We have to go for either on way or
the other.

Rivet loads the first init.tcl file it encounters in the PkgRequire search
path: it means that (on Unix) /usr/lib/rivet0.5.0/init.tcl takes
precedence over /usr/lib/rivet0.8.0 even though you want
the latter to be sourced in.
In fact it is init.tcl which sets up auto_path to include its own
directory in the scripts search path. This implies that if more
than one install of rivet is present a whole possibly wrong or
incompatible directory can be included in auto_path.

I didn't try to bind PACKAGE_VERSION to the 'package provide xxx'
command in init.tcl (thought it must be doable using autotools),
I chose to enable the user to install the Tcl library everywhere
he/she likes using --with-rivet-target-dir

 -- Massimo


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


Re: rivetlib, directory config and exit handler

Posted by David Welton <da...@gmail.com>.
Sorry for the slow response... had some messiness with work, and guests.

> src/apache-2/mod_rivet.c: during the per-interpreter
> initialization 'init.tcl' is run by calling
> Tcl_EvalFile on it.
> The path to init.tcl is obtained from RIVETLIB_DESTDIR,
> whose definition is in Makefile.am. I also changed
> src/Makefile.am to reflect this. RIVETLIB_DESTDIR
> is defined by substitution of the variable
> RIVET_TCL_TARGET (see macro rivet_target_dir in
> configure.ac). Perhaps it's suboptimal, but I only
> recently started to write m4 macros for the autotools.
> The exit handler was re-enabled and Tcl_DeleteInterp
> called upon child exit.

The apache-1 patch I see is related to init.tcl.  I forget exactly how
things work, but should we be using the PkgRequire instead of sourcing
init.tcl ?

> apache-2/TclWebapache.c: A bug (?) caused children to
> crash when dir_module was called to look up 'index.rvt'
> (or whatever else) in DirectoryIndex.
> It turned out that in this specific case the envvars
> table has a (key,value) pair where key is a valid string
> pointer, while the corresponding value is NULL.
> Fixed this by extending the check on both fields.
>
> issues that need to be addressed:
>
> 1 - make uninstall has no method that complements
> 'install-data-local' during the uninstallation phase.
> In other words we can have this things installed
> everywhere but they have to be removed manually.
>
> 2 - The env variables DATE_GMT and DATE_LOCAL carry
> wrong data. These fields are returned by ap_ht_time.
> I couldn't find a corresponding apreq2 function
> (Valery can you help?)
>
> waiting for the usual comments and inevitable
> criticism. Thank you for your patience.


-- 
David N. Welton

http://www.welton.it/davidw/

http://www.dedasys.com/

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


Re: rivetlib, directory config and exit handler

Posted by Massimo Manghi <ma...@unipr.it>.
These are the patches addressing the issues about which
I wrote last week. I added 2 patches for apache-1: one
to delete an interpreter before the child process
exits and the second to take rivetWWW.c away from
mod_rivet.c linking.
(the docs should be updated for those commands for 
which a 'package require Rivet' is needed to load 
them into the interp).

configure.ac, Makefile.am src/Makefile.am: 
a new macro 'rivet_target_dir' allows to specify 
where the Tcl stuff has to be installed. 
When not specified the variable defined by this 
macro defaults to 
${apache_base}/lib/rivet${PACKAGE_VERSION}.

src/apache-2/mod_rivet.c: during the per-interpreter 
initialization 'init.tcl' is run by calling 
Tcl_EvalFile on it.
The path to init.tcl is obtained from RIVETLIB_DESTDIR,
whose definition is in Makefile.am. I also changed
src/Makefile.am to reflect this. RIVETLIB_DESTDIR
is defined by substitution of the variable
RIVET_TCL_TARGET (see macro rivet_target_dir in 
configure.ac). Perhaps it's suboptimal, but I only
recently started to write m4 macros for the autotools.
The exit handler was re-enabled and Tcl_DeleteInterp 
called upon child exit.

apache-2/TclWebapache.c: A bug (?) caused children to 
crash when dir_module was called to look up 'index.rvt'
(or whatever else) in DirectoryIndex. 
It turned out that in this specific case the envvars 
table has a (key,value) pair where key is a valid string 
pointer, while the corresponding value is NULL. 
Fixed this by extending the check on both fields.
 
issues that need to be addressed: 

1 - make uninstall has no method that complements 
'install-data-local' during the uninstallation phase. 
In other words we can have this things installed 
everywhere but they have to be removed manually. 

2 - The env variables DATE_GMT and DATE_LOCAL carry 
wrong data. These fields are returned by ap_ht_time. 
I couldn't find a corresponding apreq2 function 
(Valery can you help?)

waiting for the usual comments and inevitable
criticism. Thank you for your patience.

 -- Massimo

--
Universita' degli Studi di Parma (http://www.unipr.it)


Re: rivetlib, directory config and exit handler

Posted by David Welton <da...@gmail.com>.
I'll try and look through this stuff soon, but I was in a small town
in Italy (Pozzonovo) with no internet connection over the weekend, and
the carrier-pigeon over IP link was down.  This week I've got a lot
happening too...

-- 
David N. Welton
http://www.welton.it/davidw/

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


Re: rivetlib, directory config and exit handler

Posted by Massimo Manghi <ma...@unipr.it>.
I apologize but I sent on the list a patch 
that included some experimental code I
had added.

--
Universita' degli Studi di Parma (http://www.unipr.it)


Re: rivetlib, directory config and exit handler

Posted by Massimo Manghi <ma...@unipr.it>.
Valery Masiutsin wrote:
> Hello, Massimo !
>
> Hm would you like to point me to the conversations about exit handlers ?
> How much time ago that was happened ?
>   
December 2005

http://mail-archives.apache.org/mod_mbox/tcl-rivet-dev/200512.mbox/browser
> I am working on replacing libapreq bits with their libapreq2 equivalents now
> (apache_* files),  API has been changed significantly (totally ?), so
> i presume it will take another week or even two. BTW those tests
> helped me a lot.
>
> Regards Valery
>
>   

I ask you for change to point me to the stuff about apreq2: I see only 
apreq_*
calls in the docs I found on apache.org, no apache_* files.

ciao

 -- Massimo


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


Re: rivetlib, directory config and exit handler

Posted by Valery Masiutsin <va...@gmail.com>.
Hello, Massimo !

Hm would you like to point me to the conversations about exit handlers ?
How much time ago that was happened ?
I am working on replacing libapreq bits with their libapreq2 equivalents now
(apache_* files),  API has been changed significantly (totally ?), so
i presume it will take another week or even two. BTW those tests
helped me a lot.

Regards Valery

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