Bug #15069 [patch] my_print_defaults does'nt care --sysconfdir
Submitted: 19 Nov 2005 17:05 Modified: 17 Apr 2006 19:12
Reporter: Francesco Riosa
Status: Closed
Category:Server Severity:S2 (Serious)
Version:4.x , 5.0.x OS:Linux (Gnu/Linux)
Assigned to: Magnus Blaudd Target Version:

[19 Nov 2005 17:05] Francesco Riosa
Description:
configure --sysconfdir=/etc/my/path
permit to specify a personalized configure file path, however this is not take in
consideration from "mysys/default.c" and as a consequence to "my_print_defaults" and (and
the others).

We modify the sources with patch reported in "Suggested fix: " section (+5 rows :).

Best Regard,
Francesco R.

How to repeat:
compile with personalized options

Suggested fix:
diff -Naur -Naur mysql-5.0.15/mysys/Makefile.am mysql-5.0.15.new/mysys/Makefile.am
--- mysql-5.0.15/mysys/Makefile.am	2005-10-17 01:27:43.000000000 +0000
+++ mysql-5.0.15.new/mysys/Makefile.am	2005-11-16 15:27:02.000000000 +0000
@@ -70,6 +70,7 @@
 			-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
 			-DDEFAULT_HOME_ENV=MYSQL_HOME \
 			-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
+			-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
                         @DEFS@

 libmysys_a_DEPENDENCIES= @THREAD_LOBJECTS@
diff -Naur -Naur mysql-5.0.15/mysys/default.c mysql-5.0.15.new/mysys/default.c
--- mysql-5.0.15/mysys/default.c	2005-10-17 01:27:31.000000000 +0000
+++ mysql-5.0.15.new/mysys/default.c	2005-11-16 15:28:43.000000000 +0000
@@ -984,6 +984,10 @@
 {
   const char *env, **ptr= default_directories;

+#ifdef DEFAULT_SYSCONFDIR
+    *ptr++= DEFAULT_SYSCONFDIR;
+#endif
+
 #ifdef __WIN__
   *ptr++= "C:/";
[21 Nov 2005 20:05] Valeriy Kravchuk
Thank you for a problem report and patch proposed. Verified just as described on 5.0.17-BK
(ChangeSet@1.1978.1.1, 2005-11-19 19:00:02+03:00):

./configure --prefix=/home/openxs/dbs/5.0 --sysconfdir=/tmp
make
make install
cd /home/openxs/dbs/5.0

Then:

[openxs@Fedora 5.0]$ bin/mysqld_safe &
[1] 8024
[openxs@Fedora 5.0]$ Starting mysqld daemon with databases from /home/openxs/dbs/5.0/var

[openxs@Fedora 5.0]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.17

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like 'innodb_buffer%';
+-------------------------------+---------+
| Variable_name                 | Value   |
+-------------------------------+---------+
| innodb_buffer_pool_awe_mem_mb | 0       |
| innodb_buffer_pool_size       | 8388608 |
+-------------------------------+---------+
2 rows in set (0,00 sec)

mysql> exit
Bye

So, innodb_buffer_pool_size has the default value, but I have my.cnf in /tmp, completely
ignored:

[openxs@Fedora 5.0]$ cat /tmp/my.cnf
[mysqld]
datadir=/home/openxs/dbs/5.0/data
set-variable = innodb_buffer_pool_size=40M
[24 Feb 2006 15:40] Francesco Riosa
dupe of bug #4993,8649
[16 Mar 2006 11:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3885
[16 Mar 2006 16:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3898
[7 Apr 2006 19:07] Ian Greenhoe
Patch looks good to me.
[7 Apr 2006 19:44] Luca Longinotti
Hi, I'm one of the other MySQL maintainers on Gentoo, and with the patch in
http://lists.mysql.com/commits/3885 (and I also tried the newer patch, which does't
change anything in that regard), we still experience this problem, but only for the
client tools. The mysqld compiles fine and has the correct path we pass to ./configure
with --sysconfdir, but the client tools (mysql etc.) seem to not respect that and simply
ignore it, and compile in only the default paths. If mysys/default.c is modified to
actually hardcode the path, it also gets used in the client tools, so as far as I can
tell it would seem it simply skips the ifdef when compiling the client tools, which would
suggest DEFAULT_SYSCONFDIR is undefined when compiling the client tools... Now I tried to
add -DDEFAULT_SYSCONFDIR="/etc/mysql" to the client/Makefile's, but it seems to have no
effect (I see it in GCC's output, but the client tools still don't use /etc/mysql as one
of their search paths), and sadly I'm no autotools guru. I can confirm this all still
happens on the latest 4.1.X and 5.0.X releases, works on 4.0.X, and I didn't test 5.1.X
yet.
Anyone has an idea? Thanks! ;)
Best regards, CHTEKK.
[10 Apr 2006 12:38] Magnus Blaudd
Ok, so we probably need to add the define to client/Makefile.am as well
[10 Apr 2006 15:09] Magnus Blaudd
Added DEFAULT_SYSCONFDIR define to libmysql/Makefile.shared as default.c is compiled
separately when creating libmysql and libmysql_r
[10 Apr 2006 15:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4713
[11 Apr 2006 11:58] Magnus Blaudd
Pushed to 5.0.21 and 5.1.10 a patch that will take the switch --sysconfdir to ./configure
into account when looking for the my.cnf file. I.e it will add that directory last in the
list where we search for my.cnf
[11 Apr 2006 16:01] Francesco Riosa
thanks !
[17 Apr 2006 19:12] Mike Hillyer
Added to 5.0.21 and 5.1.10 changelogs:

      <listitem>
        <para>
          Server and clients ignored the <option>--sysconfdir</option> option when
          passed to <filename>./configure</filename>. (Bug #15069)
        </para>
      </listitem>