Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Mar 2008 03:27:00 -0400
From:      Yarema <yds@CoolRat.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        ale@FreeBSD.org
Subject:   ports/121900: databases/mysql51-client no longer finding ~/.my.cnf 
Message-ID:  <courier.0000000047E211C4.0000C9C9@dppl.com>
Resent-Message-ID: <200803200740.m2K7e1S9007373@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         121900
>Category:       ports
>Synopsis:       databases/mysql51-client no longer finding ~/.my.cnf
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 20 07:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Yarema
>Release:        FreeBSD 6.3-STABLE amd64
>Organization:
NYCBUG.org
>Environment:
System: FreeBSD 6.3-STABLE amd64
>Description:
Upon upgrading to MySQL version 5.1.23 scripts which rely on settings from
the ~/.my.cnf file stopped working.

The problem is that mysys/default.c has the following:

#define MAX_DEFAULT_DIRS 6
const char *default_directories[MAX_DEFAULT_DIRS + 1];

while this currently broken patch to mysys/default.c not only puts
/usr/local/etc/my.cnf into the search path twice, but also pushes
~/.my.cnf beyond the MAX_DEFAULT_DIRS limit:

@@ -1102,6 +1102,8 @@
   bzero((char *) default_directories, sizeof(default_directories));
   ADD_DIRECTORY("/etc/");
   ADD_DIRECTORY("/etc/mysql/");
+  ADD_DIRECTORY("%%PREFIX%%/etc/");
+  ADD_DIRECTORY("%%PREFIX%%/etc/mysql/");
 #ifdef DEFAULT_SYSCONFDIR
   if (DEFAULT_SYSCONFDIR != "")
     ADD_DIRECTORY(DEFAULT_SYSCONFDIR);

The fix is to replace the above patch with the following:

@@ -1105,6 +1105,7 @@
 #ifdef DEFAULT_SYSCONFDIR
   if (DEFAULT_SYSCONFDIR != "")
     ADD_DIRECTORY(DEFAULT_SYSCONFDIR);
+    ADD_DIRECTORY(DEFAULT_SYSCONFDIR "/mysql/");
 #endif
   ADD_COMMON_DIRECTORIES();
   ADD_DIRECTORY("~/");

and get rid of the following from the port's Makefile:
	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/mysys/default.c

>How-To-Repeat:
Run mysql --help and look of the line following this:
Default options are read from the following files in the given order:

before the fixed mysql51-server/files/patch-mysys_default.c the output was:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf /usr/local/etc/mysql/my.cnf /usr/local/etc/my.cnf

after the fix the output is:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf /usr/local/etc/mysql/my.cnf ~/.my.cnf

and of course now ~/.my.cnf settings work once again!

>Fix:
diff -u -r -N mysql51-server~/Makefile mysql51-server/Makefile
--- mysql51-server~/Makefile	2008-02-15 03:25:26.000000000 -0500
+++ mysql51-server/Makefile	2008-03-20 03:02:12.000000000 -0400
@@ -7,7 +7,7 @@
 
 PORTNAME?=	mysql
 PORTVERSION=	5.1.23
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	databases
 MASTER_SITES=	${MASTER_SITE_MYSQL}
 MASTER_SITE_SUBDIR=	MySQL-5.1
@@ -129,7 +129,6 @@
 	@${REINPLACE_CMD} -e "s|man1_MANS =|man1_MANS = ${MAN1}|g" ${WRKSRC}/man/Makefile.in
 	@${REINPLACE_CMD} -e "s|install-data-am: install-pkgincludeHEADERS|install-data-am:|g" ${WRKSRC}/extra/Makefile.in
 	@${REINPLACE_CMD} -e "s|install-data-am: install-pkgincludeHEADERS|install-data-am:|g" ${WRKSRC}/include/Makefile.in
-	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/mysys/default.c
 	@${REINPLACE_CMD} -e "/^AM_CXXFLAGS/s|=.*|+= \$$(NDB_CXXFLAGS)|" `${FIND} ${WRKSRC}/storage/ndb -name Makefile.in`
 .if defined(WITH_PROC_SCOPE_PTH)
 	@${REINPLACE_CMD} -e "s|PTHREAD_SCOPE_SYSTEM|PTHREAD_SCOPE_PROCESS|g" ${WRKSRC}/sql/mysqld.cc
@@ -164,7 +163,6 @@
 	@${REINPLACE_CMD} -e "s|dist_pkgdata_DATA =|dist_pkgdata_DATA = mysql_fix_privilege_tables.sql|g" ${WRKSRC}/scripts/Makefile.in
 	@${REINPLACE_CMD} -e "s|man1_MANS =|man1_MANS = ${MAN1}|g;s|man8_MANS =|man8_MANS = ${MAN8}|g" ${WRKSRC}/man/Makefile.in
 	@${REINPLACE_CMD} -e "s|install-exec-am: install-binPROGRAMS|install-exec-am:|g" ${WRKSRC}/extra/Makefile.in
-	@${REINPLACE_CMD} -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/mysys/default.c
 
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/support-files/mysql.m4 ${PREFIX}/share/aclocal/
diff -u -r -N mysql51-server~/files/patch-mysys_default.c mysql51-server/files/patch-mysys_default.c
--- mysql51-server~/files/patch-mysys_default.c	2008-02-15 03:25:26.000000000 -0500
+++ mysql51-server/files/patch-mysys_default.c	2008-03-20 02:49:21.000000000 -0400
@@ -1,5 +1,5 @@
---- mysys/default.c.orig	2008-01-29 22:41:43.000000000 +0100
-+++ mysys/default.c	2008-02-14 11:03:21.000000000 +0100
+--- mysys/default.c.orig	2008-01-29 16:41:43.000000000 -0500
++++ mysys/default.c	2008-03-20 02:48:08.000000000 -0400
 @@ -623,7 +623,7 @@
    {
      MY_STAT stat_info;
@@ -9,12 +9,11 @@
      /*
        Ignore world-writable regular files.
        This is mainly done to protect us to not read a file created by
-@@ -1102,6 +1102,8 @@
-   bzero((char *) default_directories, sizeof(default_directories));
-   ADD_DIRECTORY("/etc/");
-   ADD_DIRECTORY("/etc/mysql/");
-+  ADD_DIRECTORY("%%PREFIX%%/etc/");
-+  ADD_DIRECTORY("%%PREFIX%%/etc/mysql/");
+@@ -1105,6 +1105,7 @@
  #ifdef DEFAULT_SYSCONFDIR
    if (DEFAULT_SYSCONFDIR != "")
      ADD_DIRECTORY(DEFAULT_SYSCONFDIR);
++    ADD_DIRECTORY(DEFAULT_SYSCONFDIR "/mysql/");
+ #endif
+   ADD_COMMON_DIRECTORIES();
+   ADD_DIRECTORY("~/");
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?courier.0000000047E211C4.0000C9C9>