Bug 121900 - databases/mysql51-client no longer finding ~/.my.cnf
databases/mysql51-client no longer finding ~/.my.cnf
Status: Closed FIXED
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s)
Latest
Any Any
: Normal Affects Only Me
Assigned To: Alex Dupre
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-20 07:40 UTC by yds
Modified: 2008-04-21 21:40 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (2.72 KB, patch)
2008-03-20 07:40 UTC, yds
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description yds 2008-03-20 07:40:01 UTC
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!
Comment 1 Edwin Groothuis freebsd_committer 2008-03-20 07:40:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter freebsd_committer 2008-04-21 21:34:42 UTC
ale         2008-04-21 20:34:32 UTC

  FreeBSD ports repository

  Modified files:
    databases/mysql51-server Makefile distinfo pkg-plist 
    databases/mysql51-server/files patch-mysys_default.c 
  Log:
  - Update to 5.1.24 release
  - Fix my.cnf search path [1]
  
  PR:             ports/121900 [1]
  Submitted by:   Yarema <yds@CoolRat.org> [1]
  
  Revision  Changes    Path
  1.230     +1 -3      ports/databases/mysql51-server/Makefile
  1.102     +3 -3      ports/databases/mysql51-server/distinfo
  1.5       +7 -8      ports/databases/mysql51-server/files/patch-mysys_default.c
  1.83      +8 -4      ports/databases/mysql51-server/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Alex Dupre freebsd_committer 2008-04-21 21:36:50 UTC
State Changed
From-To: open->closed

Fixed, thanks!