[MDEV-9225] mysql_upgrade segfault due to missing /etc/my.cnf.d Created: 2015-12-01 Updated: 2016-02-14 Resolved: 2016-02-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.49 |
| Type: | Bug | Priority: | Major |
| Reporter: | Robert Milasan | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream-fixed | ||
| Environment: |
uname -a cat /etc/os-release |
||
| Sprint: | 10.0.24 |
| Description |
|
Hello, I'm building a custom script which builds/installs/upgrades mariadb from 10.0.22 to 10.1.9. One part of this script is to run mysql_upgrade to ensure that the dbs are properly upgraded from 10.0.22 to 10.1.9. In 10.0.22 mysql_upgrade works without issues if '/etc/my.cnf.d' doesn't exists, but seems that this is an issue with 10.1.9:
NOTE: I don't use /etc/my.cnf.d nor I want to. |
| Comments |
| Comment by Elena Stepanova [ 2015-12-01 ] | ||||||||||||||||||
|
I've checked that neither 10.0, nor 5.5, nor MySQL up to and including 5.7 are able to start with a non-existing include directory. It appears to be reasonable, because there is no hardcoded magic about using it – the includedir directive is a part of the cnf file, so if it's there, its use is assumed to be intentional. When standard packages are installed, they use cnf file templates, which have this directive, but they also create the desired include directory, so there is no problem with them. Now, I don't know how your custom packaging/installation script works, but my best guess is that it uses some pre-created cnf files provided with the source code, but doesn't do the job required to make them actually usable. From the error message, it appears that you might be using support-files/rpm/my.cnf file (which is also strange since you're on Debian). Anyway, if you do not want to use the include dir, the solution is to generate your own cnf file rather than take an existing one. | ||||||||||||||||||
| Comment by Robert Milasan [ 2015-12-02 ] | ||||||||||||||||||
|
OK, agreed, just that the my.cnf actually got copied when doing the default install, wasn't even able to replace it in time. My problem is that is 'stupid' to have a segfault, an error, agreed, but segfault due to missing directory, sounds like a bug. You can do what you want with the bug, close or fix a segfault, as you wish. | ||||||||||||||||||
| Comment by Elena Stepanova [ 2015-12-02 ] | ||||||||||||||||||
|
I agree, crashing is never the right thing to do. Apparently it's fixed in 5.7 – while 5.6 also segfaults, 5.7 instead produces the error message "Upgrade process encountered error and will not continue.".
To reproduce, start the server (normally), and then run mysql_upgrade with --defaults-file=<filename> where <filename> contains a directive to include a non-existing folder, e.g.
| ||||||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2016-02-14 ] | ||||||||||||||||||
|
The bug-fix can not be taken from upstream as it includes a complete refactoring of the related code. However, the fix is simple. We were freeing a null pointer (as can be seen in the stacktrace, where argv=0x0). free_defaults should check if the argv pointer is NULL. | ||||||||||||||||||
| Comment by Robert Milasan [ 2016-02-14 ] | ||||||||||||||||||
|
Thanks, yes, a pointer should be checked before freeing | ||||||||||||||||||
| Comment by Vicențiu Ciorbaru [ 2016-02-14 ] | ||||||||||||||||||
|
Fixed with: https://github.com/MariaDB/server/commit/2a4781789612c6c53cbe12c1426f93b15737a148 |