Bug 28617 - misc/kohalib.pl no longer useful
Summary: misc/kohalib.pl no longer useful
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-23 09:45 UTC by Jonathan Druart
Modified: 2021-07-19 09:05 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 28617: Remove kohalib.pl and rely on PERL5LIB (37.81 KB, patch)
2021-07-19 09:04 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-06-23 09:45:44 UTC
This script is used by command line scripts to load the Koha lib.
Should not we rely on PERL5LIB instead?
Comment 1 Jonathan Druart 2021-06-23 09:50:28 UTC
This is not an enforced rule for all our CLI scripts, if it was really useful for someone we would have heard about them.
Comment 2 Martin Renvoize 2021-06-23 10:34:16 UTC
Must admit, I've never entirely understood what this script was all about and why we didn't set PERL5LIB somewhere instead.. I'm not sure recent scripts have included it and I've not come across issues using those (either as standard, dev or package installs).

Perhaps ask Galen if he knows of a reason to keep it?
Comment 3 Marcel de Rooy 2021-06-23 11:09:43 UTC
We should remove it and replace all occurrences like:
 eval { require "$FindBin::Bin/../kohalib.pl" };
Comment 4 Tomás Cohen Arazi 2021-06-23 11:44:11 UTC
I think the idea was to prevent some lib being replaced by a malicious one on a different path. Pretty much like the . fix Perl added.
Comment 5 David Cook 2021-06-23 23:54:11 UTC
(In reply to Jonathan Druart from comment #0)
> This script is used by command line scripts to load the Koha lib.
> Should not we rely on PERL5LIB instead?

+1
Comment 6 Galen Charlton 2021-07-16 20:04:01 UTC
If you're interested in the history, make yourself a hot beverage of your choice and read

http://koha.1045719.n5.nabble.com/RFC-installer-changes-td3065475.html

Time marches on, and one of the motivations for having kohalib.pl - making it possible to install Koha without setting a single environment variable - has been obviated by the vast improvements in the ease of installing Koha.

Consequently, I think kohalib.pl can go away.

As far as upgrade worries are concerned, a release note advising anybody who is still actively upgrading ancient Koha systems from tarballs that they should double-check that PERL5LIB is set in crontabs should suffice.
Comment 7 Jonathan Druart 2021-07-19 09:04:51 UTC
Created attachment 122935 [details] [review]
Bug 28617: Remove kohalib.pl and rely on PERL5LIB

The purpose of this script was to load the relevant Koha lib for the
different scripts (installation, cronjob, CLI, etc.)
However it is not used consistently and we prefer to rely on PERL5LIB.

From bug 28617 comment 6 from Galen:
"""
Time marches on, and one of the motivations for having kohalib.pl - making
it possible to install Koha without setting a single environment variable -
has been obviated by the vast improvements in the ease of installing Koha.

Consequently, I think kohalib.pl can go away.
"""

Test plan:
confirm that the changes make sense and that kohalib.pl can be removed
safely.
Comment 8 Jonathan Druart 2021-07-19 09:05:29 UTC
Thanks, Galen!