[OPEN-ILS-DEV] srfsh woes

Scott McKellar mck9 at swbell.net
Sun May 20 00:27:04 EDT 2007


--- Dan Scott <denials at gmail.com> wrote:

> On 19/05/07, Scott McKellar <mck9 at swbell.net> wrote:
> > What am I missing?
> >
> > I've been trying to compile and link a complete working copy of
> > srfsh, but it's not reading the configuration file usefully.

<snip>

> > Is the sample configuration file on the Wiki really correct?
> 
> Nope. Well, it wasn't, but now it is.
> 
> Hope this helps!

Yes it does.  Thank you.  I can load the new sample without
incident, except of course that I had to change the path for the 
log file to something that existed on my machine.

I also figured out, contrary to my earlier conclusions, that the
bootstrap function returns zero for failure and non-zero for
success, rather than the other way around.

However the use of return codes is confusing and inconsistent.

If the config file does not specify a log file, the 
osrf_system_bootstrap_client_resc function (or its wrapper function
osrf_system_bootstrap_client()) returns -1, indicating a sort of
success.  If the config file does specify a log file, and the
bootstrapping is successful in other respects, the function returns
1, indicating complete success.

In practice, the code that calls osrf_system_bootstrap_client_resc()
or its wrapper does not distinguish between partial and complete
success.  It just looks for zero or non-zero.

In osrf_system_bootstrap_client_resc(): If we notice that the
config file doesn't specify a log file, we issue an error message
and return -1 immediately.  By so doing, we bypass the call to
client_connect().  (We also leak memory, but that's another issue.)

On the other hand if the config file does specify a log file, we
proceed to call client_connect(), returning 1 if we connect 
successfully and 0 if we don't.

The puzzling result is that if we get a successful (i.e. non-zero)
return from osrf_system_bootstrap_client_resc(), we may or may not
have created the connection, depending on whether the configuration
specified a log file.

Is that really the intent?

I would have expected that, if we don't have a log file, we either
return zero to indicate a fatal error, or try to connect anyway.
It's not at all obvious why we should ever report success without
even trying to connect.  Perhaps I just haven't gotten far enough
along to discern the reason.

Scott McKellar
http://home.swbell.net/mck9/aargh/



More information about the Open-ils-dev mailing list