Bug 40901: (QA follow-up) Fix Z39.50 option expansion and honour the indexer defaults
Two problems in how the units consume koha-generate-env's output:
1. koha-z3950@.service passed ${Z3950_ADDITIONAL_OPTS}. In systemd unit
files "${VAR}" always expands to exactly one argument, and to a single
empty argument when the variable is empty; only unbraced "$VAR" is
word-split. So a configured value like "--add-item-status k -t 5"
reached z3950_responder.pl as one unknown option, and the default
empty value reached it as a "" listener address. Verified with
systemd-run: ${X}="--a --b" gives ["--a --b"], ${Y}="" gives [""],
$X gives ["--a"] ["--b"]. Use the unbraced form.
2. koha-indexer@.service hardcoded rebuild_zebra.pl -daemon -sleep,
ignoring ALTERNATE_INDEXER_DAEMON and INDEXER_PARAMS from
/etc/default/koha-common that the SysV path honours. koha-generate-env
now resolves INDEXER_DAEMON and INDEXER_PARAMS exactly like
koha-indexer and the unit runs them through /usr/bin/env, so any
configured indexer works.
koha-generate-env is also tightened up: numeric values are validated
and fall back to their defaults, every value is forced onto one line
without quote characters so the EnvironmentFile always parses, the
debug_mode test matches is_debug_mode, Z3950_ADDITIONAL_OPTS is read
from /etc/default/koha-common first (as before this patchset), the
Z39.50 config dir uses the same config.xml test as is_z3950_enabled,
the env dir is created with the instance's ownership if it does not
exist yet, and unknown services get an empty env file instead of a
chmod failure. The responder is invoked through /usr/bin/perl like the
other Perl daemons.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
3fb9421561
commit
5562b26bb0
|
|
@ -16,7 +16,10 @@ Environment=KOHA_HOME=/usr/share/koha
|
|||
Environment=PERL5LIB=/usr/share/koha/lib
|
||||
ExecStartPre=+/usr/sbin/koha-generate-env indexer %i
|
||||
EnvironmentFile=-/run/koha/%i/indexer.env
|
||||
ExecStart=/usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -sleep ${INDEXER_TIMEOUT}
|
||||
# INDEXER_DAEMON honours ALTERNATE_INDEXER_DAEMON and INDEXER_PARAMS from
|
||||
# /etc/default/koha-common, resolved by koha-generate-env like koha-indexer
|
||||
# does. $INDEXER_PARAMS is unbraced on purpose so it is split into arguments.
|
||||
ExecStart=/usr/bin/env ${INDEXER_DAEMON} $INDEXER_PARAMS
|
||||
ProtectSystem=full
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
|
|
|
|||
|
|
@ -17,8 +17,11 @@ Environment=PERL5LIB=/usr/share/koha/lib
|
|||
PIDFile=/run/koha/%i/z3950-responder.pid
|
||||
ExecStartPre=+/usr/sbin/koha-generate-env z3950 %i
|
||||
EnvironmentFile=-/run/koha/%i/z3950.env
|
||||
ExecStart=/usr/share/koha/bin/z3950_responder.pl \
|
||||
${Z3950_ADDITIONAL_OPTS} \
|
||||
# $Z3950_ADDITIONAL_OPTS is deliberately unbraced: systemd splits "$VAR" into
|
||||
# separate arguments (and into none when empty) whereas "${VAR}" is always
|
||||
# exactly one argument.
|
||||
ExecStart=/usr/bin/perl /usr/share/koha/bin/z3950_responder.pl \
|
||||
$Z3950_ADDITIONAL_OPTS \
|
||||
--config-dir ${Z3950_CONFIGDIR} \
|
||||
-u %i-koha \
|
||||
-p /run/koha/%i/z3950-responder.pid \
|
||||
|
|
|
|||
Loading…
Reference in New Issue