[Koha] Z3950 Misbehaviours Fixed

Mike D. dalgity at htl.net
Tue Aug 8 17:53:42 NZST 2006


Over the past day or two I've been setting up Z39.50 servers on my Koha 2.2.5 
running on OpenBSD 3.9 and ran into several issues which I've been able to 
resolve so I'm posting here in case someone has similar issues. First two 
pertain to running Koha on *BSD but the other two are more general.
Mike D.


PROBLEM:
attempting to start Z3950 with z3950-daemon-launch.sh results in the following 
error:
	# ./z3950-daemon-launch.sh
	# This account is currently not available.

CAUSE:
OpenBSD's default Apache configuration is more secure than most. By default the 
www user has no login shell and normally apache is chrooted to /var/www after 
it starts. Most cgi scripts require some modification to run in the chroot. I 
may eventually work on getting Koha running in the chrooted Apache but until 
then I've just disabled it.

SOLUTION:
Since the www user has no shell and therefore can't run the z3950 I've created 
a z3950 user and modified z3950-daemon-options to reflect this.
# cat z3950-daemon-options
#20060806 - changed RunAsUser from www to z3950
RunAsUser=z3950
KohaZ3950Dir=/var/www/koha/intranet/scripts/z3950daemon
KohaModuleDir=/var/www/koha/intranet/modules
LogDir=/var/www/koha/log
KohaConf=/etc/koha.conf
	


PROBLEM:
attempting to start Z3950 with z3950-daemon-launch.sh results in the following 
error:
	# ./z3950-daemon-launch.sh
	# su: no such login 
class: /var/www/koha/intranet/scripts/z3950daemon/z3950-daemon-shell.sh

CAUSE:
The syntax for the su command in /koha/intranet/scripts/z3950daemon/z3950-
daemon-launch.sh is invalid for OpenBSD and FreeBSD and quite likely NetBSD.

For OpenBSD (FreeBSD and NetBSD are similar) the command syntax is:
su [-fKLlm] [-a auth-type] [-c login-class] [login [shell arguments]]
also the '-' switch has been deprecated in favour of -l

SOLUTION:
Change the su command in z3950-daemon-launch.sh. So instead of
su -c $KohaZ3950Shell - $RunAsUser &

change it to the following
su -l $RunAsUser -c $KohaZ3950Shell &

The -c is actually an argument to the shell in this case which means take a 
command from argument instead of stdin. It should work with sh, csh, tcsh, ksh, 
and bash shells.

I have filed a bug report on this issue which contains the same information as 
above. See bug #1141 http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1141



PROBLEM:
The following problems MAY only appear when using the NPL template.

1) When using the NPL template Z3950 search results from certain servers may 
not be present in the pop-up "Z3950 Search Results" even though the log 
indicates that records were found and retrieved from that server. I 
specifically had this problem when searching AMICUS.

2) You may get error messages in the z3950 log file like the following:
Can't call method "size" on an undefined value 
at /var/www/koha/intranet/scripts/z3950daemon/processz3950queue line 271.

I would get that error when trying to query the Library of Congress server. You 
will also notice that log file will be missing entries that normally appear. 
The following lines marked with *** should normally appear but don't.
24369/32 : Processing isbn=0672305410 at LIBRARY OF CONGRESS z3950.loc.gov:7090 
Voyager MARC21 (8 forks)
24369/32 : 2 >> 
24369/32 : creating and 24369/32 : working on results entry 69
24369/32 : connected to LIBRARY OF CONGRESS
***24369/32 : LIBRARY OF CONGRESS : 1 records found, retrieving them (max 80)
***24369/32 : z3950.loc.gov:7090 search done.

3) If you are accessing multiple Z3950 servers you may notice in the pop-
up "Z3950 Search Results" that one or more seem not to respond. The page will 
infinitely display "Still 1 requests to go" or whatever number of servers are 
not responding. If you notice this, it's most likely related to the #2 symptom 
above.

The following threads also discuss similar symptoms:
20060306 http://thread.gmane.org/gmane.comp.misc.koha/5696/focus=5696
20051129 http://thread.gmane.org/gmane.comp.misc.koha/5315/focus=5316
20051028 http://thread.gmane.org/gmane.comp.misc.koha/5211/focus=5219
20051026 http://thread.gmane.org/gmane.comp.misc.koha/5201/focus=5201
20051006 http://thread.gmane.org/gmane.comp.misc.koha/5101/focus=5101
20050905 http://thread.gmane.org/gmane.comp.misc.koha/4978/focus=4978
20050103 http://thread.gmane.org/gmane.comp.misc.koha/4152/focus=4152


CAUSE: 
This is a symptom of bug #1051 http://bugs.koha.org/cgi-
bin/bugzilla/show_bug.cgi?id=1051

Basically the MARC flavour option was changed from USMARC to MARC21 but the NPL 
template wasn't updated. The result is that the remote server isn't informed of 
your MARC flavour preference. The offending snippets of code are listed below.

NPL version of z3950servers.tmpl:
<select name="syntax">
         <option value="USMARC">USMARC</option>
         <option value="UNIMARC">UNIMARC</option>
</select>

DEFAULT version of z3950servers.tmpl:
<select name="syntax">
         <option value="MARC21">MARC21</option>
         <option value="UNIMARC">UNIMARC</option>
</select>

processz3950queue:

eval { $conn->option(preferredRecordSyntax =>
 Net::Z3950::RecordSyntax::USMARC);} if ($globalsyntax eq "MARC21");
eval { $conn->option(preferredRecordSyntax =>
 Net::Z3950::RecordSyntax::UNIMARC);} if ($globalsyntax eq "UNIMARC");

Looking at CVS it appears this bug was introduced into processz3950queue on Mar 
30 2005. As of Jun 11 2006 MARC21 was switched back to USMARC.

SOLUTION:
Since the NPL version of z3950servers.tmpl is the odd one out, the easiest 
thing to do is modify it to be the same as the default version (see code 
snippets above). It appears the latest code has reverted back to USMARC and you 
*SHOULD* also be able to change the default template and processz3950queue to 
mirror those changes. Alternatively, the next time you upgrade to 2.2.6 or 
later this problem should be resolved (or at least this specific cause will be).



PROBLEM:
When using NPL and a Z3950 search completes the "Z3950 Search Results" 
refreshes into an Error 404 when attempting to load the page /cgi-
bin/koha/z3950/0/

20060405 http://article.gmane.org/gmane.comp.misc.koha/5798/match=z3950
20051026 http://article.gmane.org/gmane.comp.misc.koha/5201/match=z3950
20050818 http://article.gmane.org/gmane.comp.misc.koha/4935/match=z3950 my own 
question on this problem last year :)


SOLUTION:
Thomas D. has posted a fix a number of times (thanks again)
http://article.gmane.org/gmane.comp.misc.koha/5316/match=z3950
http://thread.gmane.org/gmane.comp.misc.koha/4925/focus=4935

but since this has been around since at least version 2.2.3 I've opened a bug 
report. Bug #1143 http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1143



More information about the Koha mailing list