Hi Tzafrir,

On Tue, 11 Sep 2001, Tzafrir Cohen wrote:

> Hi folks
> A new version of the complete r2l package is here: 0.1.0
> Emil: refreshd fails if BIDITEXT_FILENAME is not set. but you shouldn't
> query the environment directly: you should ask r2llib what is the token
> (as I did in the above command).

Is it refreshd itself or the application (in refreshd_hook.so) who is
failing ? I suppose it's the latter, and indeed, this behavior is
`normal'. Hmm smells like yet another "It's not a bug, it'a a feature"
thing ;-). But let me try to explain things first.

The idea was that I wanted to support the --r2l-filename command line
parameter. The code from refreshd_hook.so runs `on foreign ground' (i.e.
inside a different process which is a descendant of the `biditext'
application or script). Yes you are right, `biditext' can be a shell
script. In order to operate properly, refreshd_hook.so needs to know the
serialization string of the r2l token. I think that the safest way to pass
this string around is through the environment. The idea was that the
biditext script creates an r2l token in the usual way, based on either on
the --r2l-filename command line parameter, the BIDITEXT_FILENAME
environment variable, ${HOME}/.rev or ./.rev files. After the token is
created, `biditext' sets the BIDITEXT_FILENAME variable to the r2l token
serialization (whether the BIDITEXT_FILENAME variable was previously set
or not) and execs the application. The advantage of this scheme is that
refreshd_hook.so will see the BIDITEXT_FILENAME variable set correctly, no
matter how many fork()s and exec??()s took place from the moment the
application was started and until refreshd_hook.so code gets executed. Of
course this assumes that exec??()s are never performed with a new
evironment and that the application does not modify the BIDITEXT_FILENAME
variable. So the assumption was that `biditext' will always set the
BIDITEXT_FILENAME variable correctly before exec??()-ing the application,
as it sets all the rest of the variables (e.g. LD_PRELOAD).

I can see a related problem inside the biditext.so library. This library
passess NULL,0,NULL to r2l_init(). This means that it does not support the
--rev-filename parameter. If we use a `good' `biditext' script, then
everything is OK since a `correct' `biditext' script sets the
BIDITEXT_FILENAME first before exec??()-ing the application. Note that in
this case r2l_init(NULL,0,NULL) will create an r2llib_t instance based
on the contents of BIDITEXT_FILENAME environment varaiable. Thus, support
for the --r2l-filename option is added, albeit in a quite weird way.

In short it is the task of `biditext' to make sure all the variables are
set correctly (including BIDITEXT_FILENAME). Only after `biditext' sets
the BIDITEXT_FILENAME variable to the serialization string from r2llib,
the rest of the code queries the environment. So the situation in which
BIDITEXT_FILENAME should not normally happen.


Haifa Linux Club Projects Mailing List (http://linuxclub.il.eu.org)
To unsub send an empty message to [EMAIL PROTECTED]

Reply via email to