Bug 13793

Summary: The installer does not output the result of the update using Plack
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dpavlin, katrin.fischer, m.de.rooy, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 13791, 19756    
Attachments: Bug 13793: Make the installer output the result of the updates under Plack
Bug 13793: Make the installer output the result of the updates under Plack
Bug 13793: Make the installer output the result of the updates under Plack

Description Jonathan Druart 2015-03-04 10:50:46 UTC
Under Plack, the installer does not output the result of the update.
Comment 1 Jonathan Druart 2015-03-04 11:03:52 UTC Comment hidden (obsolete)
Comment 2 Dobrica Pavlinusic 2015-03-05 09:59:37 UTC Comment hidden (obsolete)
Comment 3 Brendan Gallagher 2015-03-06 09:54:57 UTC
Created attachment 36657 [details] [review]
Bug 13793: Make the installer output the result of the updates under Plack

Test plan:
0/ Start plack for intranet
1/ Create a new entry in updatedatabase.pl, something like:

$DBversion = "3.19.00.013";
if(CheckVersion($DBversion)) {
    print "Upgrade to $DBversion done (Bug test plack - This is a
est)\n";
    print "Upgrade to $DBversion done (Bug test plack - This is anoter
est)\n";
    print "Upgrade to $DBversion done (Bug test plack - This is a third
est)\n";
    warn "this is an error";
}
and modify the kohaversion.pl accordingly.
You can also warn something to simulate an error.
2/ Go on the mainpage (or wherever you want), you should be redirected
to the installer
3/ Notice that the output of the updatedatabase is displayed on the
screen.
4/ Confirm that new files have been created in your Koha log directory
(check the logdir entry in your koha conf file).
5/ Confirm that the output is still displayed without Plack.

Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2015-03-15 12:23:04 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 5 Katrin Fischer 2015-03-15 21:14:08 UTC
With this patch I can't run the web installer in my dev installation. Following error is displayed:

Cannot open log file /home/katrin/koha-dev/var/log/updatedatabase_2015-03-15T21:59:53.log: No such file or directory at /home/katrin/kohaclone/installer/install.pl line 332.

After reverting the patch the update process is completed normally.
Comment 6 Tomás Cohen Arazi 2015-03-15 22:42:55 UTC
Katrin, i tested both with and without plack on a regular dev install before pushing. Please share some details about your directory structure and permission.
Comment 7 Katrin Fischer 2015-03-15 22:48:06 UTC
Sure, it might be my installation, but I thought it would be better to have someone check. This is a standard dev installation. The logs are being written to  /home/katrin/koha-dev/var/log

The files within the directory currently are:
-rw-r--r-- 1 root   root   436429 Mär 15 23:11 koha-error_log
-rw-r--r-- 1 root   root    98095 Mär  6 14:55 koha-opac-error_log
-rw-r--r-- 1 katrin katrin   3657 Mär 15 02:46 koha-zebradaemon.err
-rw-r--r-- 1 katrin katrin  13428 Mär 15 23:19 koha-zebradaemon-output.log

I am not sure why there is a mix of root/katrin. Writing to the existing files seems to work alright.
Comment 8 Katrin Fischer 2015-03-15 22:53:36 UTC
And permissions on the directory itself:

drwxr-xr-x 2 katrin katrin 4096 Mär 15 23:45 log
Comment 9 Marcel de Rooy 2015-03-16 08:54:05 UTC
Cannot open log file /usr/share/kohadev/testclone/var/log/updatedatabase_2015-03-16T09:42:31.log: No such file or directory at /usr/share/koha/testclone/installer/install.pl line 332.

If I update via the webinstaller, the apache user has no permission to write a new log file in that directory.
Comment 10 Marcel de Rooy 2015-03-19 08:47:48 UTC
Mar 19 09:40:31 kernel: type=1400 audit(): avc:  denied  { write } for  pid=14194 comm="sh" name="log" dev="md2" ino=11150563 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=unconfined_u:object_r:httpd_log_t:s0 tclass=dir

If I set the permission of this log folder to 777 (which I do not like!), I stumble over my next security measure: SELinux. That's good :)
I can go further and add exceptions for that too of course. But I think we are working in the wrong direction.

Can we REVERT this patch please?
The patch is meant for Plack users. Please write it so that non-Plack users are not affected.
Comment 11 Jonathan Druart 2015-03-19 15:53:45 UTC
See bug 13876 for a fix.