Bug 8162 - packaging scripts create user incorrectly
Summary: packaging scripts create user incorrectly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: 3.8
Hardware: All All
: P3 critical (vote)
Assignee: Robin Sheat
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-29 18:42 UTC by Jared Camins-Esakov
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 8162: allow packages to work on Ubuntu Precise (4.09 KB, patch)
2012-07-20 10:37 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 8162: allow packages to work on Ubuntu Precise (4.22 KB, patch)
2012-07-28 13:12 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-05-29 18:42:34 UTC
For reasons that are unclear, the user created by koha-restore will not allow Koha to log into MySQL (oddly, an identical script worked fine for me on my 3.6.3-based install). The result is that after running koha-restore on a new system (and possibly even when just restoring a backup), Koha is entirely nonfunctional. Patch forthcoming.
Comment 1 Jared Camins-Esakov 2012-05-29 19:16:44 UTC
Sorry, my mistake. MySQL 5.5 on Precise Pangolin does recognize '%' as a host wildcard that includes localhost.
Comment 2 Jared Camins-Esakov 2012-05-29 19:28:17 UTC
I changed my mind. This is a bug. The packages will not work under Ubuntu 12.04. This is problematic.
Comment 3 Robin Sheat 2012-06-11 15:01:11 UTC
Do you know why?
Comment 4 Robin Sheat 2012-06-11 15:01:24 UTC
(and under what circumstances?)
Comment 5 Jared Camins-Esakov 2012-06-13 23:36:28 UTC
Sorry, didn't notice the question. When MySQL is on the same host and the --create-db option is used on koha-create, the database users created by the script are not used by the web server because of a combination of % not matching localhost (I think), and anonymous users taking precedence over non-anonymous users in MySQL 5.5.
Comment 6 Robin Sheat 2012-07-19 14:36:42 UTC
Going to take a look at this now.
Comment 7 Robin Sheat 2012-07-20 10:37:32 UTC Comment hidden (obsolete)
Comment 8 Robin Sheat 2012-07-20 10:40:50 UTC
These should go in to 3.6 and 3.8 also I think.
Comment 9 Jonathan Druart 2012-07-23 14:52:04 UTC
Perhaps you could take advantage of modiying this file to remove the useless use of cat:
   [ `cat $PASSWDFILE | grep "^$name:"` ]
can be replaced with
    [ ` grep "^$name:" $PASSWDFILE ` ]

It seems good but I have not Ubuntu for testing.
Comment 10 Jared Camins-Esakov 2012-07-28 13:12:02 UTC
Created attachment 11180 [details] [review]
Bug 8162: allow packages to work on Ubuntu Precise

The newer version of MySQL in Ubuntu 12.04 installs a default
'localhost' user with no username. Due to the way that MySQL looks up
user details when you connect, if you connect from localhost and the
user was only created with a wildcard host (%), the anonymous localhost
user will be found instead. This means that your username is lost for
the connection, and you have no privileges.

This patch creates a second user with a hostname of 'localhost'. This
will not work if your database is on a remote server, but you probably
know what you are doing if that's the case. Patches to determine this
server's name relative to the MySQL server are welcome (or even ideas on
how to do it.)

It also fixes up a couple of other small things:
* make koha-remove stop zebra properly
* stop the warning that the password file is missing on create

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Works as promised.
Comment 11 Mason James 2012-08-10 04:16:29 UTC
(In reply to comment #10)
> Created attachment 11180 [details] [review]
> Bug 8162: allow packages to work on Ubuntu Precise
> 
> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
> Works as promised.


i'm going to pass QA on this, despite Jonathan's 'cat' suggestion
(hope thats ok)

mason@xen1:~/git/head$ koha-qa.pl 
        * c1f0e96 Bug 8162: allow packages to work on Ubuntu Precise
                debian/scripts/koha-create
                debian/scripts/koha-remove

- perlcritic-progressive tests... OK
- perl -c syntax tests... OK
- xt/tt_valid.t tests... OK
- xt/author/valid-template.t tests... OK
Comment 12 Chris Cormack 2012-08-10 19:41:52 UTC
Important patch, will allow the packages to work cleanly on Ubuntu 12.04 for 3.8.4 pushed to 3.8.x
Comment 13 Paul Poulain 2012-08-29 11:47:46 UTC
Patch pushed to master today (I haven't tested it, I haven't the needed environment)