ports/182547: [PATCH] databases/mariadb55-server: Respect hier(7) (also affects databases/mariadb55-client)

Michael Gmelin freebsd at grem.de
Tue Oct 1 14:00:02 UTC 2013


>Number:         182547
>Category:       ports
>Synopsis:       [PATCH] databases/mariadb55-server: Respect hier(7) (also affects databases/mariadb55-client)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 01 14:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Michael Gmelin
>Release:        FreeBSD 9.1-RELEASE-p2 amd64
>Organization:
Grem Equity GmbH
>Environment:
System: FreeBSD bsd64.grem.de 9.1-RELEASE-p2 FreeBSD 9.1-RELEASE-p2 #5 r249052M: Fri May 31 17:50:16 UTC
>Description:

Like outlined in [1], MariaDB looks for my.cnf in /etc and /etc/mysql
instead of $PREFIX/etc and $PREFIX/etc/mysql. The attached patch fixes
this, so that hier(7) is respected and $PREFIX/etc is used instead of
/etc. This is in line with the behavior found in and expected by
$PREFIX/bin/mysqld_safe.  A note has been put in pkg-message (using
pkg-message.in) to inform users about the fix. Portrevision has been
bumped.

[1] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/182426#reply2

Port maintainer (never at nevermind.kiev.ua) is cc'd.

Generated with FreeBSD Port Tools 0.99_7 (mode: change, diff: suffix)
>How-To-Repeat:
echo garbage >/etc/my.cnf
mysql
(shouldn't barf, but will)

echo garbage >/usr/local/etc/my.cnf
mysql
(should barf, but won't)

>Fix:
Apply the attached patch to mariadb55-{server|client}

cd /usr/ports
patch -p0 </path/to/mariadb-5.5.33a_1.patch

portmaster databases/mariadb55-server
...
===>>> pkg-message for mariadb-client-5.5.33a_1
************************************************************************

MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc and /usr/local/etc/mysql.

************************************************************************

===>>> pkg-message for mariadb-server-5.5.33a_1
************************************************************************

Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
the first time you start the MySQL server after an upgrade from an
earlier version.

MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc and /usr/local/etc/mysql.

************************************************************************


--- mariadb-5.5.33a_1.patch begins here ---
diff -ruN databases.orig/mariadb55-client/Makefile databases/mariadb55-client/Makefile
--- databases.orig/mariadb55-client/Makefile	2013-10-01 00:36:19.000000000 +0200
+++ databases/mariadb55-client/Makefile	2013-10-01 15:13:15.285388241 +0200
@@ -7,7 +7,7 @@
 
 MASTERDIR=	${.CURDIR}/../mariadb55-server
 
-PKGMESSAGE=	mustnotexist
+FILESDIR=	${.CURDIR}/files
 PATCHDIR=	${.CURDIR}/files
 PLIST=		${.CURDIR}/pkg-plist
 
diff -ruN databases.orig/mariadb55-client/files/patch-mysys_default.c databases/mariadb55-client/files/patch-mysys_default.c
--- databases.orig/mariadb55-client/files/patch-mysys_default.c	2013-01-05 12:30:51.000000000 +0100
+++ databases/mariadb55-client/files/patch-mysys_default.c	2013-10-01 14:09:39.946911423 +0200
@@ -1,11 +1,11 @@
---- mysys/default.c.orig	2012-12-17 03:57:40.000000000 +0200
-+++ mysys/default.c	2012-12-17 04:00:28.000000000 +0200
+--- mysys/default.c.orig	2013-10-01 13:43:36.657414854 +0200
++++ mysys/default.c	2013-10-01 13:45:00.242608502 +0200
 @@ -89,7 +89,7 @@
  
  /* Which directories are searched for options (and in which order) */
  
 -#define MAX_DEFAULT_DIRS 6
-+#define MAX_DEFAULT_DIRS 7
++#define MAX_DEFAULT_DIRS 5
  #define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1)  /* Terminate with NULL */
  static const char **default_directories = NULL;
  
@@ -18,11 +18,19 @@
      /*
        Ignore world-writable regular files.
        This is mainly done to protect us to not read a file created by
-@@ -1229,6 +1229,7 @@
- #if defined(DEFAULT_SYSCONFDIR)
-   if (DEFAULT_SYSCONFDIR[0])
-     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
-+    errors += add_directory(alloc, DEFAULT_SYSCONFDIR "/mysql", dirs);
- #endif /* DEFAULT_SYSCONFDIR */
+@@ -1223,13 +1223,8 @@
+ 
+ #else
+ 
+-  errors += add_directory(alloc, "/etc/", dirs);
+-  errors += add_directory(alloc, "/etc/mysql/", dirs);
+-
+-#if defined(DEFAULT_SYSCONFDIR)
+-  if (DEFAULT_SYSCONFDIR[0])
+-    errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
+-#endif /* DEFAULT_SYSCONFDIR */
++  errors += add_directory(alloc, "%%PREFIX%%/etc/", dirs);
++  errors += add_directory(alloc, "%%PREFIX%%/etc/mysql/", dirs);
  
  #endif
+ 
diff -ruN databases.orig/mariadb55-client/files/pkg-message.in databases/mariadb55-client/files/pkg-message.in
--- databases.orig/mariadb55-client/files/pkg-message.in	1970-01-01 01:00:00.000000000 +0100
+++ databases/mariadb55-client/files/pkg-message.in	2013-10-01 14:06:11.816172461 +0200
@@ -0,0 +1,7 @@
+************************************************************************
+
+MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
+my.cnf. Please move existing my.cnf files from those paths to
+%%PREFIX%%/etc and %%PREFIX%%/etc/mysql.
+
+************************************************************************
diff -ruN databases.orig/mariadb55-server/Makefile databases/mariadb55-server/Makefile
--- databases.orig/mariadb55-server/Makefile	2013-10-01 00:32:28.000000000 +0200
+++ databases/mariadb55-server/Makefile	2013-10-01 15:24:35.085467022 +0200
@@ -2,7 +2,7 @@
 
 PORTNAME?=	mariadb
 PORTVERSION=	5.5.33a
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	databases ipv6
 MASTER_SITES=	http://ftp.osuosl.org/pub/mariadb/${PORTNAME}-${PORTVERSION}/kvm-tarbake-jaunty-x86/ \
 		http://mirrors.supportex.net/mariadb/${PORTNAME}-${PORTVERSION}/kvm-tarbake-jaunty-x86/ \
@@ -18,6 +18,9 @@
 MAINTAINER=	never at nevermind.kiev.ua
 COMMENT?=	Multithreaded SQL database (server)
 
+SUB_FILES=	pkg-message
+PKGMESSAGE=	${WRKDIR}/pkg-message
+
 SLAVEDIRS=	databases/mariadb55-client
 USES=		cmake gmake
 NO_OPTIONS_SORT=yes
@@ -136,6 +139,7 @@
 
 post-patch:
 	@${REINPLACE_CMD} 's/*.1/${MAN1}/' ${WRKSRC}/man/CMakeLists.txt
+	@${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/mysys/default.c
 
 .include <bsd.port.pre.mk>
 
diff -ruN databases.orig/mariadb55-server/files/patch-mysys_default.c databases/mariadb55-server/files/patch-mysys_default.c
--- databases.orig/mariadb55-server/files/patch-mysys_default.c	2013-01-05 12:30:51.000000000 +0100
+++ databases/mariadb55-server/files/patch-mysys_default.c	2013-10-01 14:10:01.769397522 +0200
@@ -1,15 +1,15 @@
---- mysys/default.c.orig	2010-11-02 23:01:13.000000000 +0100
-+++ mysys/default.c	2010-11-10 16:39:51.000000000 +0100
-@@ -70,7 +70,7 @@
+--- mysys/default.c.orig	2013-10-01 13:43:36.657414854 +0200
++++ mysys/default.c	2013-10-01 13:45:00.242608502 +0200
+@@ -89,7 +89,7 @@
  
  /* Which directories are searched for options (and in which order) */
  
 -#define MAX_DEFAULT_DIRS 6
-+#define MAX_DEFAULT_DIRS 7
++#define MAX_DEFAULT_DIRS 5
  #define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1)  /* Terminate with NULL */
  static const char **default_directories = NULL;
  
-@@ -711,7 +711,7 @@
+@@ -785,7 +785,7 @@
    {
      MY_STAT stat_info;
      if (!my_stat(name,&stat_info,MYF(0)))
@@ -18,14 +18,19 @@
      /*
        Ignore world-writable regular files.
        This is mainly done to protect us to not read a file created by
-@@ -1153,7 +1153,10 @@
+@@ -1223,13 +1223,8 @@
  
- #if defined(DEFAULT_SYSCONFDIR)
-   if (DEFAULT_SYSCONFDIR[0])
-+  {
-     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
-+    errors += add_directory(alloc, DEFAULT_SYSCONFDIR "/mysql", dirs);
-+  }
- #endif /* DEFAULT_SYSCONFDIR */
+ #else
+ 
+-  errors += add_directory(alloc, "/etc/", dirs);
+-  errors += add_directory(alloc, "/etc/mysql/", dirs);
+-
+-#if defined(DEFAULT_SYSCONFDIR)
+-  if (DEFAULT_SYSCONFDIR[0])
+-    errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
+-#endif /* DEFAULT_SYSCONFDIR */
++  errors += add_directory(alloc, "%%PREFIX%%/etc/", dirs);
++  errors += add_directory(alloc, "%%PREFIX%%/etc/mysql/", dirs);
  
  #endif
+ 
diff -ruN databases.orig/mariadb55-server/files/pkg-message.in databases/mariadb55-server/files/pkg-message.in
--- databases.orig/mariadb55-server/files/pkg-message.in	1970-01-01 01:00:00.000000000 +0100
+++ databases/mariadb55-server/files/pkg-message.in	2013-10-01 14:06:12.395346909 +0200
@@ -0,0 +1,11 @@
+************************************************************************
+
+Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
+the first time you start the MySQL server after an upgrade from an
+earlier version.
+
+MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
+my.cnf. Please move existing my.cnf files from those paths to
+%%PREFIX%%/etc and %%PREFIX%%/etc/mysql.
+
+************************************************************************
diff -ruN databases.orig/mariadb55-server/pkg-message databases/mariadb55-server/pkg-message
--- databases.orig/mariadb55-server/pkg-message	2013-01-05 12:30:51.000000000 +0100
+++ databases/mariadb55-server/pkg-message	1970-01-01 01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-************************************************************************
-
-Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
-the first time you start the MySQL server after an upgrade from an
-earlier version.
-
-************************************************************************
--- mariadb-5.5.33a_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list