emerge --config doesn't behave as expected when more than one instance are declared in my.cnf. the post install corrupts CONTENTS file and creates wrong datadirs' tree. Also, equery is unable to parse CONTENTS after an emerge --config mysql-... equery b <something> ... !!! Parse error in '/var/db/pkg/dev-db/mysql-5.0.54/CONTENTS' !!! line 8: Unrecognized CONTENTS entry !!! line 10: Unrecognized CONTENTS entry !!! line 12: Unrecognized CONTENTS entry !!! line 14: Unrecognized CONTENTS entry !!! line 16: Unrecognized CONTENTS entry !!! line 17: Unrecognized CONTENTS entry !!! line 18: Unrecognized CONTENTS entry because of the following lines, dir /var/lib dir /var/lib/mysql dir /var/lib/mysql/data1 dir /var/lib/mysql/data1 /var dir /var/lib/mysql/data1 /var/lib dir /var/lib/mysql/data1 /var/lib/mysql dir /var/lib/mysql/data1 /var/lib/mysql/data2 Moreover, buggy directories are created during the post install of mysql, like the following: # find /var/lib/mysql/data1? /var/lib/mysql/data1? /var/lib/mysql/data1?/var /var/lib/mysql/data1?/var/lib /var/lib/mysql/data1?/var/lib/mysql /var/lib/mysql/data1?/var/lib/mysql/data2 /var/lib/mysql/data1?/var/lib/mysql/data2/.keep_dev-db_mysql-0 (? is the CR character) Reproducible: Always Steps to Reproduce: 1.mysql uses more than 1 instance [mysqldx] in my.cnf x=1..9 2.every instances have a different datadir=/var/lib/mysql/datax directory x=1..9 3.emerge -auv mysql 4.emerge --config =dev-db/mysql-5.0.54 Actual Results: mysql CONTENTS becomes corrupt after an emerge --config if more then 1 instance is declared in my.cnf Expected Results: emerge --config should handle the fact that my.cnf could describe more than one instance of mysqld an therefore will contain more than one datadir. If I remember well, DATADIR variable contains a list of "datadir" strings with spaces and CR in the case described above. The script should abort or consider DATADIR as a list of directories instead. Thx
The pkg_config block of mysql does NOT edit CONTENTS in any way. Either it was corrupt after the initial emerge, or something else on your system broke it. Attach the CONTENTS file here, in it's present state, as well as after 'emerge --unmerge mysql && emerge mysql'. Additionally, the pkg_config block (via mysql_init_vars) should look at the [mysqld] section of your config, which does exist right? (I'm aware of a lot of other stuff that will break otherwise).
The CONTENTS file is never edited by portage, nor any tool that I know of. Please post emerge --info.
(In reply to comment #1) > The pkg_config block of mysql does NOT edit CONTENTS in any way. If I understand well how portage works, CONTENTS is used to properly uninstall the package during the unmerge process. so it is necessarily generated during the emerge install process ... and corrupted during that time. > Additionally, the pkg_config block (via mysql_init_vars) should look at the > [mysqld] section of your config, which does exist right? (I'm aware of a lot of > other stuff that will break otherwise). > In fact, not necessary. You won't have any [mysqld] but [mysqld1], [mysqld2], etc. like instances, otherwise msqlmanager will be lost. please warn when you modify the script. (after an daily scheduled emerge --sync) # diff -ruN /var/tmp/mysql.eclass /usr/portage/eclass/mysql.eclass --- /var/tmp/mysql.eclass 2008-04-05 12:10:20.000000000 +0200 +++ /usr/portage/eclass/mysql.eclass 2008-04-05 03:05:52.000000000 +0200 @@ -1,6 +1,6 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.88 2008/03/10 02:47:20 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/mysql.eclass,v 1.89 2008/04/05 00:43:26 robbat2 Exp $ # Author: Francesco Riosa (Retired) <vivo@gentoo.org> # Maintainer: MySQL Team <mysql-bugs@gentoo.org> @@ -226,7 +226,8 @@ | tail -n1` if [[ -z "${MY_DATADIR}" ]] ; then MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ - | sed -e 's/.*=\s*//'` + | sed -e 's/.*=\s*//' \ + | tail -n1` fi fi if [[ -z "${MY_DATADIR}" ]] ; then Indeed, tail corrects the issue but that is not really elegant. Actually, it would be great if mysqld eclass takes account of all mysqld instances and not just the last one ;) Thx for the fast reply
It's extremely difficult to find them all, because there are no constraints on what they are named at all. I know some folks that don't even have 'mysqld' as a substring of the name.
zmedico, as a test, if you make a filename with \n in it, does Portage handle the generation of CONTENTS correctly?
Newlines in filenames aren't currently handled. It seem like we could escape them without hurting anything. It shouldn't cause any compatibility issues since the current behavior is severely broken in that case anyway.
(In reply to comment #4) > It's extremely difficult to find them all, because there are no constraints on > what they are named at all. I agree with you but they didn't need to have a /n or /r in their names to reproduce the issue. Just create two [mysqld1] and [mysqld2] in my.cf. I know some folks that don't even have 'mysqld' as > a substring of the name. Yes, but in that case emerge config won't recognize any instances at all .The CONTENTS file as well the database directory name won't be corrupt then.
mysql.eclass has the tail fix already, just portage left on this bug. removing mysql-bugs.
In svn r11918, it's fixed to bail out if the package tries to install any file paths containing newlines.
This is fixed in 2.2_rc15.