While trying to test another bug. I was annoyed by the floody nature of TransformHtmlToMarc in C4/Biblio.pm To reproduce: 1) Back up your intranet error log -- for example: cp ~/koha-dev/var/log/koha-error-log ~/koha-error-log.backup 2) Blank your intranet error log -- for example: echo > ~/koha-dev/var/log/koha-error-log 3) Log into your staff client 4) Click 'Authorities' 5) Click 'New from Z39.50' 5) Type 'Seuss' into 'Name (any):' and press enter 6) Click 'Import' beside the first link 7) Click 'Save' 8) Check your koha-error-log -- floody! 9) Apply patch 10) repeat steps 2-8 -- blank! 11) restore your intranet error log -- for example: mv ~/koha-error-log.backup ~/koha-dev/var/log/koha-error-log 12) run koha qa test tools
Created attachment 52832 [details] [review] Bug 16809: Silence authority warnings C4::Biblio::TransformHtmlToMarc Most of the floodiness is caused by accessing the cgi parameters in a context which is hard to determine. By purposefully saving the value to a scalar variable and using the variable, the issue disappears, and it will likely be a tiny tad faster as variable access is faster than multiple function calls. TEST PLAN --------- 1) Back up your intranet error log -- for example: cp ~/koha-dev/var/log/koha-error-log ~/koha-error-log.backup 2) Blank your intranet error log -- for example: echo > ~/koha-dev/var/log/koha-error-log 3) Log into your staff client 4) Click 'Authorities' 5) Click 'New from Z39.50' 5) Type 'Seuss' into 'Name (any):' and press enter 6) Click 'Import' beside the first link 7) Click 'Save' 8) Check your koha-error-log -- floody! 9) Apply patch 10) repeat steps 2-8 -- blank! 11) restore your intranet error log -- for example: mv ~/koha-error-log.backup ~/koha-dev/var/log/koha-error-log 12) run koha qa test tools
Hi Mark, I was unable to replicate the flooding, but the patch doesn't seem to hurt anything. Not super into change for the sake of it, can you still replicate this on current master? Cheers, Liz
mtompset@debian:~/kohaclone$ echo > ~/koha-dev/var/log/koha-error_log mtompset@debian:~/kohaclone$ cat ~/koha-dev/var/log/koha-error_log | cut -f12- -d" " | sort -u [Sun Aug 7 10:40:24 2016] authorities.pl: CGI::param called in list context from package C4::Biblio line 2580, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/authorities/authorities.pl?breedingid=115&authtypecode=PERSO_NAME&authid=0 [Sun Aug 7 10:40:24 2016] authorities.pl: CGI::param called in list context from package C4::Biblio line 2588, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/authorities/authorities.pl?breedingid=115&authtypecode=PERSO_NAME&authid=0 [Sun Aug 7 10:40:24 2016] authorities.pl: CGI::param called in list context from package C4::Biblio line 2605, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/authorities/authorities.pl?breedingid=115&authtypecode=PERSO_NAME&authid=0 [Sun Aug 7 10:40:24 2016] authorities.pl: CGI::param called in list context from package C4::Biblio line 2608, this can lead to vulnerabilities. See the warning in "Fetching the value or values of a single named parameter" at /usr/share/perl5/CGI.pm line 436., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/authorities/authorities.pl?breedingid=115&authtypecode=PERSO_NAME&authid=0 $ uname -a Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux $ sudo apache2 -v Server version: Apache/2.4.10 (Debian) Server built: Jul 20 2016 06:48:18 Yes, Liz. I do still get it.
Created attachment 54535 [details] [review] Bug 16809: Silence authority warnings C4::Biblio::TransformHtmlToMarc Most of the floodiness is caused by accessing the cgi parameters in a context which is hard to determine. By purposefully saving the value to a scalar variable and using the variable, the issue disappears, and it will likely be a tiny tad faster as variable access is faster than multiple function calls. TEST PLAN --------- 1) Back up your intranet error log -- for example: cp ~/koha-dev/var/log/koha-error-log ~/koha-error-log.backup 2) Blank your intranet error log -- for example: echo > ~/koha-dev/var/log/koha-error-log 3) Log into your staff client 4) Click 'Authorities' 5) Click 'New from Z39.50' 5) Type 'Seuss' into 'Name (any):' and press enter 6) Click 'Import' beside the first link 7) Click 'Save' 8) Check your koha-error-log -- floody! 9) Apply patch 10) repeat steps 2-8 -- blank! 11) restore your intranet error log -- for example: mv ~/koha-error-log.backup ~/koha-dev/var/log/koha-error-log 12) run koha qa test tools Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested with addbiblio.pl. I would have preferred the scalar option in terms of simpler code, but this works too.
Created attachment 54536 [details] [review] Bug 16809: Follow-up for scalarizing biblionumber Still resolves another multi_param warning. Test plan: Look at your logs before and after this patch when saving a biblio record (you may have to start plack again). If your biblionumber is mapped to 999c, you should no longer have a warn about line 2563 (disclaimer: line numbers are subject to change). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 54649 [details] [review] Bug 16809: Silence authority warnings C4::Biblio::TransformHtmlToMarc Most of the floodiness is caused by accessing the cgi parameters in a context which is hard to determine. By purposefully saving the value to a scalar variable and using the variable, the issue disappears, and it will likely be a tiny tad faster as variable access is faster than multiple function calls. TEST PLAN --------- 1) Back up your intranet error log -- for example: cp ~/koha-dev/var/log/koha-error-log ~/koha-error-log.backup 2) Blank your intranet error log -- for example: echo > ~/koha-dev/var/log/koha-error-log 3) Log into your staff client 4) Click 'Authorities' 5) Click 'New from Z39.50' 5) Type 'Seuss' into 'Name (any):' and press enter 6) Click 'Import' beside the first link 7) Click 'Save' 8) Check your koha-error-log -- floody! 9) Apply patch 10) repeat steps 2-8 -- blank! 11) restore your intranet error log -- for example: mv ~/koha-error-log.backup ~/koha-dev/var/log/koha-error-log 12) run koha qa test tools Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested with addbiblio.pl. I would have preferred the scalar option in terms of simpler code, but this works too. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 54650 [details] [review] Bug 16809: Follow-up for scalarizing biblionumber Still resolves another multi_param warning. Test plan: Look at your logs before and after this patch when saving a biblio record (you may have to start plack again). If your biblionumber is mapped to 999c, you should no longer have a warn about line 2563 (disclaimer: line numbers are subject to change). Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master for 16.11, thanks Marcel, Mark!
Pushed to 3.22.x, will be in 3.22.11