Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 402803 - mysql-v2.eclass does not keepdir the DATADIR
Summary: mysql-v2.eclass does not keepdir the DATADIR
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-09 07:18 UTC by Eray Aslan
Modified: 2013-01-20 02:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mysql-autotools.patch (mysql-autotools.patch,451 bytes, patch)
2012-02-09 12:37 UTC, Eray Aslan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eray Aslan gentoo-dev 2012-02-09 07:18:47 UTC
On upgrade from dev-db/mysql-5.1.56 to dev-db/mysql-5.1.61 /var/lib/mysql is gone from the filesystem.  This machine is part of a failover cluster so /var/lib/mysql  is mounted and populated only during a failover (i.e during upgrade /var/lib/mysql was empty).

With no /var/lib/mysql after upgrade, failover will fail as it won't be able to find the mount point.

Quick look suggests that mysql.eclass seems to keepdir the DATADIR whereas mysql-v2.eclass does not.  Please consider restoring the keepdir behaviour for DATADIR in mysql-v2.eclass.

Reproducible: Always
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-02-09 07:57:21 UTC
The logic is exactly the same, it's just not in mysql-v2.eclass.

old logic:
        if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
            dodir "${MY_DATADIR#${EPREFIX}}"
            keepdir "${MY_DATADIR#${EPREFIX}}"
            chown -R mysql:mysql "${D}/${MY_DATADIR}"
        fi  

new logic (mysql-cmake.eclass / mysql-autotools.eclass):
        if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
            dodir "${MY_DATADIR#${EPREFIX}}"
            keepdir "${MY_DATADIR#${EPREFIX}}"
            chown -R mysql:mysql "${D}/${MY_DATADIR}"
        fi  


I don't know why it cares about PREVIOUS_DATADIR however, I think it should always be doing keepdir.

Does the old mysql.eclass based ebuilds also not keepdir?
Comment 2 Francesco Riosa 2012-02-09 11:09:37 UTC
Hem, at the time of writing that check I've simply put all together, the idea is that if the datadir was present it's totally user responsibility.
The logic can be wrong, what happen if:
a) portage 1st install mysql
b) portage update mysql
    b1) mysql is built but datadir is already present
    b2) portage merge the file in the filesystem w/o the keepdir
    b3) portage remove superfluous files, included keepdir

so yes, the keepdir should always be done, or at least check that the previous datadir is != /var/lib/mysql
Comment 3 Eray Aslan gentoo-dev 2012-02-09 12:37:03 UTC
Created attachment 301379 [details, diff]
mysql-autotools.patch

Just confirming that moving keepdir out of the if...then preserves the datadir directory on upgrade.  Ditto for mysql-cmake.eclass probably.
Comment 4 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2012-02-09 13:45:59 UTC
(In reply to comment #1)
> The logic is exactly the same, it's just not in mysql-v2.eclass.
> 
> old logic:
>         if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
>             dodir "${MY_DATADIR#${EPREFIX}}"
>             keepdir "${MY_DATADIR#${EPREFIX}}"
>             chown -R mysql:mysql "${D}/${MY_DATADIR}"
>         fi  
> 
> new logic (mysql-cmake.eclass / mysql-autotools.eclass):
>         if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then
>             dodir "${MY_DATADIR#${EPREFIX}}"
>             keepdir "${MY_DATADIR#${EPREFIX}}"
>             chown -R mysql:mysql "${D}/${MY_DATADIR}"
>         fi  
> 
> 
> I don't know why it cares about PREVIOUS_DATADIR however, I think it should
> always be doing keepdir.
> 
> Does the old mysql.eclass based ebuilds also not keepdir?

Robin,

I can't check the eclasses now, but I suspect it might be tied to the PREFIX support added to the eclasses.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-20 02:42:01 UTC
InCVS