Bug #10749 Startup script fails if launched through symlink
Submitted: 19 May 2005 16:09 Modified: 1 Jun 2005 13:35
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version: OS:Linux (Linux)
Assigned to: Vladimir Kolesnikov CPU Architecture:Any

[19 May 2005 16:09] [ name withheld ]
On linux, the script bin/mysql-query-browser incorrectly determines the mysql-query-browser base directory, if it is linked to by a symbolic link and this symlink is used to start the program. Hence the program cannot be started. 

How to repeat:
#ln -s /path/to/query/browser/bin/mysql-query-browser /usr/local/bin/mysql-query-browser

Suggested fix:
The following code taken from the Jakarta Ant project, as used in their startup script: 


# need this for relative symlinks
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG=`dirname "$PRG"`"/$link"

MYPATH=`dirname "$PRG"`

BASEPATH=`cd $MYPATH/.. ; pwd`

[29 May 2005 0:58] Jorge del Conde
Thanks for your bug report.  I was able to reproduce this using FC2, and the latest version of QB.
[1 Jun 2005 13:35] Vladimir Kolesnikov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

thanks for the example