Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 216190
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Portage team <dev-portage@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Jimmy.Jazz@gmx.net
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 216190 depends on: Show dependency tree
Bug 216190 blocks: 210077 216231
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-04-04 14:22 0000
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

------- Comment #1 From Robin Johnson 2008-04-05 00:47:29 0000 -------
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).

------- Comment #2 From Zac Medico 2008-04-05 01:15:43 0000 -------
The CONTENTS file is never edited by portage, nor any tool that I know of.
Please post emerge --info.

------- Comment #3 From Jimmy.Jazz@gmx.net 2008-04-05 10:39:33 0000 -------
(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

------- Comment #4 From Robin Johnson 2008-04-05 21:32:16 0000 -------
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.

------- Comment #5 From Robin Johnson 2008-04-05 21:33:06 0000 -------
zmedico, as a test, if you make a filename with \n in it, does Portage handle
the generation of CONTENTS correctly? 

------- Comment #6 From Zac Medico 2008-04-05 22:17:05 0000 -------
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.

------- Comment #7 From Jimmy.Jazz@gmx.net 2008-04-16 19:32:02 0000 -------
(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.

------- Comment #8 From Robin Johnson 2008-11-14 21:53:49 0000 -------
mysql.eclass has the tail fix already, just portage left on this bug.
removing mysql-bugs.

------- Comment #9 From Zac Medico 2008-11-15 04:17:49 0000 -------
In svn r11918, it's fixed to bail out if the package tries to install any file
paths containing newlines.

------- Comment #10 From Zac Medico 2008-11-22 05:50:58 0000 -------
This is fixed in 2.2_rc15.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug