Bug 19088

Summary: plugins-upload.pl causes uninitialized value noise
Product: Koha Reporter: Lee Jamison <ldjamison>
Component: ToolsAssignee: Lee Jamison <ldjamison>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, katrin.fischer, mtj, mtompset
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:
Attachments: Test Plugin KPZ
Bug 19088: plugins-upload causes error log noise
Bug 19088: plugins-upload causes error log noise
Bug 19088: plugins-upload causes error log noise

Description Lee Jamison 2017-08-11 13:36:29 UTC
After uploading a plugin, plack-error.log indicates the message

Use of uninitialized value $op in string eq at /home/vagrant/kohaclone/plugins/plugins-upload.pl line 57.
Use of uninitialized value $op in string eq at /home/vagrant/kohaclone/plugins/plugins-upload.pl line 92.
Comment 1 Lee Jamison 2017-08-11 19:38:26 UTC
Created attachment 65926 [details]
Test Plugin KPZ

Test plugin KPZ file to use to test this bug
Comment 2 Lee Jamison 2017-08-11 19:44:31 UTC
Created attachment 65928 [details] [review]
Bug 19088: plugins-upload causes error log noise

After uploading a plugin the error log indicates
use of uninitialized value in $op. This patch
silences the noise.

To test:
1) Set <enable_plugins> to 1 (one) in koha-conf.xml.
2) Set the UseKohaPlugins system preference to 'Enable'.
3) Navigate to Administration -> Manage plugins.
4) Install the test plugin KPZ file attached to this bug.
5) Notice the uninitialized value noise in the error log.
6) Uninstall the plugin (plack restart may be required if plack is
    enabled).
7) Apply patch.
8) Install the plugin again.
9) Notice no noise in the error log.
10) Run qa tools.
11) Run prove t/db_dependent/Plugins.t
Comment 3 Mark Tompsett 2017-08-12 14:50:34 UTC
Comment on attachment 65928 [details] [review]
Bug 19088: plugins-upload causes error log noise

Review of attachment 65928 [details] [review]:
-----------------------------------------------------------------

::: plugins/plugins-upload.pl
@@ +47,4 @@
>  
>  my $uploadfilename = $input->param('uploadfile');
>  my $uploadfile     = $input->upload('uploadfile');
> +my $op             = $input->param('op') || q{};

// is better.
if 'op' is '0', then this would set $op to ''.
|| evaluates truthy only.
// is a defined check.
http://perldoc.perl.org/perlop.html#Logical-Defined-Or
Comment 4 Mark Tompsett 2017-08-12 15:21:04 UTC
Don't even need the plugin. Using the breadcrumbs to go back you can trigger the error over and over. :)
Comment 5 Mark Tompsett 2017-08-12 15:21:34 UTC
Created attachment 65936 [details] [review]
Bug 19088: plugins-upload causes error log noise

After uploading a plugin the error log indicates
use of uninitialized value in $op. This patch
silences the noise.

To test:
1) Set <enable_plugins> to 1 (one) in koha-conf.xml.
2) Set the UseKohaPlugins system preference to 'Enable'.
3) Navigate to Administration -> Manage plugins.
4) Install the test plugin KPZ file attached to this bug.
5) Notice the uninitialized value noise in the error log.
6) Uninstall the plugin (plack restart may be required if plack is
    enabled).
7) Apply patch.
8) Install the plugin again.
9) Notice no noise in the error log.
10) Run qa tools.
11) Run prove t/db_dependent/Plugins.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Mark Tompsett 2017-08-12 15:23:02 UTC
In an old school git install, it still triggers noise, just in a different log. Leave it up to the tester to know which log it should be in.
Comment 7 Jonathan Druart 2017-08-28 19:34:59 UTC
Created attachment 66564 [details] [review]
Bug 19088: plugins-upload causes error log noise

After uploading a plugin the error log indicates
use of uninitialized value in $op. This patch
silences the noise.

To test:
1) Set <enable_plugins> to 1 (one) in koha-conf.xml.
2) Set the UseKohaPlugins system preference to 'Enable'.
3) Navigate to Administration -> Manage plugins.
4) Install the test plugin KPZ file attached to this bug.
5) Notice the uninitialized value noise in the error log.
6) Uninstall the plugin (plack restart may be required if plack is
    enabled).
7) Apply patch.
8) Install the plugin again.
9) Notice no noise in the error log.
10) Run qa tools.
11) Run prove t/db_dependent/Plugins.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Jonathan Druart 2017-08-30 20:02:31 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 9 Fridolin Somers 2017-09-29 13:35:00 UTC
Pushed to 17.05.x, will be in 17.05.05.
Comment 10 Katrin Fischer 2017-10-01 22:24:04 UTC
This patch has been pushed to 16.11.x and will be in 16.11.13.
Comment 11 Mason James 2017-11-23 22:09:22 UTC
Pushed to 16.05.x, for 16.05.18 release