[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] Ext tests/scripts
On Tue, 2005-02-15 at 00:09 +0100, Henrik Stoerner wrote:
> On Tue, Feb 15, 2005 at 09:32:02AM +1100, Adam Goryachev wrote:
> > On Mon, 2005-02-14 at 22:59 +0100, Henrik Stoerner wrote:
> > > NB: The environment variables provided by Hobbit to a script is not
> > > quite the same as that which BB provides. Some BB extensions use
> > > environment variables for some commands, e.g $GREP instead of grep.
> > > Hobbit does not set this up by default, so you should check what
> > > your scripts expect, and if necessary add the extra environment
> > > variables to hobbitserver.cfg (or change the script).
> >
> > Just wondering if there is a reason for this?
>
> Sure is.
>
> Finding the commands to go with those environment variables is tricky,
> since some implementations hide the useful ones in odd
> places. E.g. have you ever tried getting the wrong "id" command on
> Solaris ? The useful one is /usr/xpg4/bin/id, not /bin/id (which
> doesn't know about all those options I take for granted because I'm
> spoilt by GNU software).
Yes, going from Linux to solaris was..... fun <?> same for linux ->
*BSD, though maybe not so bad. I very much missed by GNU software :)
> Just an example ... don't get me started on /usr/ccs/bin or
> /usr/ucb/bin or the horrors in /opt :-(
Yep....
> Since Hobbit doesn't use those commands *at all* - the only shell
> scripts in Hobbit are the wrappers to set up environments for the CGI
> scripts - it would be a lot of effort with no benefit to Hobbit.
Yep, I begin to see...
> And really, most of the BB extensions really are client-side scripts.
> They'll run just fine as extensions to the BB client. Hobbit is a
> server-side replacement (yes, I know there are thoughts and plans and
> even some code for a Hobbit client, but that's some time into the
> future), so the number of scripts that are bitten by this is fairly
> small, I think.
This I suppose is the real reason.... ie, it doesn't matter *most* of
the time....
> > It would seem a shame to need to make all these scripts *more*
> > specific...
>
> Just add the needed ones to hobbitserver.cfg - it might be as simple
> as
>
> SED=sed
> GREP=grep
> AWK=awk
> CAT=cat
> TR=tr
>
> to make them work and just use whatever is in the PATH.
Are these defined once for all ext scripts, or once for each ext script?
Can they be sourced (. /foo.bar)?
It would be interesting if we could take these file location definitions
from BB, but maybe even that small amount of data is copyright/license
infringing/something...
Perhaps all those ext scripts I wrote should start with something like:
if [ ! -x ${GREP} ]
then
if [ ! -x grep ]
then
COLOR=red
LINE="grep binary not found and env variable GREP not executable
(${GREP})"
else
GREP=grep
fi
fi
or something similar....
Mostly, as you said, this will affect the clients more.... so, for now,
I will just keep quiet.
Regards,
Adam
--
--
Adam Goryachev
Website Managers
Ph: +61 2 8304 0000 adam (at) websitemanagers.com.au
Fax: +61 2 9345 4396 www.websitemanagers.com.au