| Bug #10986 | mysql_config: incorrect locations when it is a symbolic link | ||
|---|---|---|---|
| Submitted: | 31 May 2005 14:55 | Modified: | 25 Jul 2005 19:33 |
| Reporter: | Geert Vanderkelen | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | 4.1.12 | OS: | Linux (Linux) |
| Assigned to: | Jim Winstead | CPU Architecture: | Any |
[25 Jun 2005 0:58]
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/internals/26423
[5 Jul 2005 23:50]
Jim Winstead
Fixed in 4.1.13 and 5.0.9.
[25 Jul 2005 19:33]
Mike Hillyer
Documented in 4.1.13 and 5.0.9 changelogs: <listitem><para>The <literal>mysql_config</literal> script did not handle symbolic linking properly. (Bug #10986)</para></listitem>

Description: Hi, Usually I install mysql in /usr/local/mysql and make symbolic links of mysql, mysqladmin and mysql_config in /usr/local/bin. Executing `mysql_config --libs` I got wrong results though: $ /usr/local/mysql/bin/mysql_config --libs -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm $ /usr/local/bin/mysql_config --libs -L/usr/local/lib -lmysqlclient -lz -lcrypt -lnsl -lm Regards, Geert How to repeat: $ /usr/local/mysql/bin/mysql_config --libs -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm $ ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config $ /usr/local/bin/mysql_config --libs -L/usr/local/lib -lmysqlclient -lz -lcrypt -lnsl -lm Suggested fix: Change get_full_path() in mysql_config to something like this: Will check if mysql_config is a symbolic link, if so, get the original file so that will be used to get the basedir. get_full_path () { if [ -h $1 ]; then echo `ls -l $1 | awk '{ print $NF }'` else case $1 in /*) echo "$1";; ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/\./;/;' ;; *) which $1 ;; esac fi } Could use stat instead, but I guess ls and awk are more.. universal