Bug 28052

Summary: keys omitted in check for system preference override
Product: Koha Reporter: Colin Campbell <colin.campbell>
Component: SIP2Assignee: Colin Campbell <colin.campbell>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrewfh, fridolin.somers, jonathan.druart, joonas.kylmala, kyle, martin.renvoize, nick, 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:
21.05.00,20.11.05,20.05.11
Bug Depends on: 20954    
Bug Blocks:    
Attachments: patch to extract keys only for loop
Bug 28052 Do not check SYSENV values only keys in loop
Bug 28052 Do not check SYSENV values only keys in loop

Description Colin Campbell 2021-03-30 11:12:30 UTC
loop should look at the keys of of system environment settings, it does not and treats the hash as an array - it can cause misleading errors as the contents of some some keys are undefined.
Comment 1 Colin Campbell 2021-03-30 11:28:38 UTC
Created attachment 118990 [details] [review]
patch to extract keys only for loop

Very trivial patch. loop body only concerned with keys, should not be looking at values
Comment 2 Colin Campbell 2021-03-30 11:30:52 UTC
omission of keys was probably a typo in original patch
Comment 3 Martin Renvoize 2021-03-30 12:21:37 UTC
*** Bug 25993 has been marked as a duplicate of this bug. ***
Comment 4 Martin Renvoize 2021-03-30 12:22:59 UTC
Created attachment 119000 [details] [review]
Bug 28052 Do not check SYSENV values only keys in loop

Loop is only interested in key values, because 'keys' is omitted
it is checking values as well. This can lead to misleading errors
being logged (e.g. key is undefined)
Extract keys only to loop array as in the other loops below this

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Nick Clemens 2021-03-30 14:06:13 UTC
Created attachment 119010 [details] [review]
Bug 28052 Do not check SYSENV values only keys in loop

Loop is only interested in key values, because 'keys' is omitted
it is checking values as well. This can lead to misleading errors
being logged (e.g. key is undefined)
Extract keys only to loop array as in the other loops below this

Testing:
1 - tail /var/lib/koha/kohadev/sip-output.log
2 - in another tab use the sip cli tester:
   perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m checkin --item CHESS1
3 - Note errors:
Use of uninitialized value $key in index at /kohadevbox/koha/C4/SIP/Sip/MsgType.pm line 337, <STDIN> line 1.
Use of uninitialized value $key in index at /kohadevbox/koha/C4/SIP/Sip/MsgType.pm line 337, <STDIN> line 2.
4 - Apply patch and restart all the things
5 - Repeat 2
6 - Errors mentioned are gone

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 6 Jonathan Druart 2021-04-01 16:55:46 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-04-15 10:37:33 UTC
Pushed to 20.11.x for 20.11.05
Comment 8 Andrew Fuerste-Henry 2021-04-24 16:41:11 UTC
Pushed to 20.05.x for 20.05.11
Comment 9 Victor Grousset/tuxayo 2021-04-24 17:17:18 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.