Bug 26434

Summary: Plugin dirs duplicates in @INC with plack
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: Architecture, internals, and plumbingAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: aleisha, dcook, kyle, lucas, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.05, 19.11.11, 19.05.16
Bug Depends on:    
Bug Blocks: 26849    
Attachments: Bug 26434: Fix plugin dirs addition to @INC
Bug 26434: Fix plugin dirs addition to @INC
Bug 26434: Fix plugin dirs addition to @INC
Bug 26434: add Array::Utils module [19.05]

Description Fridolin Somers 2020-09-11 14:02:38 UTC
Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".
Comment 1 Fridolin Somers 2020-09-11 14:12:58 UTC
Created attachment 109946 [details] [review]
Bug 26434: Fix plugin dirs addition to @INC

Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".

This bug was identified with Carrousel plugin : https://inlibro.com/instructions-carrousel/

Test plan :
1) Enable plack and plugins
2) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
3) Install plugin KitchenSink : https://github.com/bywatersolutions/koha-plugin-kitchen-sink
4) Dont apply patch
5) Use configure on KitchenSink
6) Look at page about.pl : @INC contains server plugin dir 'var/lib/plugins'
7) Apply patch and restart plack
8) Use configure on KitchenSink
9) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
Comment 2 Fridolin Somers 2020-09-11 14:15:28 UTC
Strangely we also see in @INC the template dirs :
koha-tmpl/opac-tmpl and koha-tmpl/intranet-tmpl
The duplicates like plugin dirs thats causes the error.
With patch thoses dirs aren't duplicate anymore.
Comment 3 David Cook 2020-09-14 07:06:38 UTC
I want to say that I've seen these duplicates as well although I'd have to look again.

I'm not sure about this solution though. I think this could use some more investigation.
Comment 4 Kyle M Hall 2020-09-14 13:14:41 UTC
(In reply to Fridolin SOMERS from comment #2)
> Strangely we also see in @INC the template dirs :
> koha-tmpl/opac-tmpl and koha-tmpl/intranet-tmpl
> The duplicates like plugin dirs thats causes the error.
> With patch thoses dirs aren't duplicate anymore.

Considering the way TT finds plugins and include files, I'm not surprised it would push template directories onto @INC.
Comment 5 Kyle M Hall 2020-09-14 13:16:22 UTC
Created attachment 110056 [details] [review]
Bug 26434: Fix plugin dirs addition to @INC

Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".

This bug was identified with Carrousel plugin : https://inlibro.com/instructions-carrousel/

Test plan :
1) Enable plack and plugins
2) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
3) Install plugin KitchenSink : https://github.com/bywatersolutions/koha-plugin-kitchen-sink
4) Dont apply patch
5) Use configure on KitchenSink
6) Look at page about.pl : @INC contains server plugin dir 'var/lib/plugins'
7) Apply patch and restart plack
8) Use configure on KitchenSink
9) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Martin Renvoize 2020-09-17 08:32:16 UTC
Created attachment 110255 [details] [review]
Bug 26434: Fix plugin dirs addition to @INC

Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".

This bug was identified with Carrousel plugin : https://inlibro.com/instructions-carrousel/

Test plan :
1) Enable plack and plugins
2) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
3) Install plugin KitchenSink : https://github.com/bywatersolutions/koha-plugin-kitchen-sink
4) Dont apply patch
5) Use configure on KitchenSink
6) Look at page about.pl : @INC contains server plugin dir 'var/lib/plugins'
7) Apply patch and restart plack
8) Use configure on KitchenSink
9) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2020-09-17 08:33:04 UTC
Simple clean fix, no regresssions, no QA failures.

Passing QA
Comment 8 Jonathan Druart 2020-09-28 09:10:47 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 9 Lucas Gass 2020-10-16 16:26:54 UTC
backported to 20.05.x for 20.05.05
Comment 10 Aleisha Amohia 2020-10-20 02:03:17 UTC
backported to 19.11.x for 19.11.11
Comment 11 Victor Grousset/tuxayo 2020-10-20 21:15:06 UTC
Backported to 19.05.x branch for 19.05.16
Comment 12 Mason James 2020-10-27 14:13:42 UTC
Created attachment 112577 [details] [review]
Bug 26434: add Array::Utils module [19.05]
Comment 13 Victor Grousset/tuxayo 2020-10-27 17:46:05 UTC
Backport to 19.05.x fixed, thanks James! :)