Bug #56279 Mac installer does not work as documented

Submitted: 26 Aug 2010 5:19 Modified: 29 Aug 2010 17:25
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.1.50 OS:MacOS (10.5, 10.6)
Assigned to: CPU Architecture:Any

[26 Aug 2010 5:19] Hakan Küçükyılmaz
Description:
The installation document for MySQL on Mac OS X says

The Mac OS X PKG of MySQL installs itself into
`/usr/local/mysql-VERSION' and also installs a symbolic link,
`/usr/local/mysql', that points to the new location. If a directory
named `/usr/local/mysql' exists, it is renamed to
`/usr/local/mysql.bak' first. Additionally, the installer creates the
grant tables in the `mysql' database by executing `mysql_install_db'.

However, the mysql.bak renaming does not work. Also, mysql_install_db fails under certain conditions, too. I will report the mysql_install_db in a separate bug.

How to repeat:
I used mysql-5.1.50-osx10.6-x86.dmg on my Mac OS X 10.6.

* Mount the image
* Double click mysql-5.1.50-osx10.6-x86_64.dmg
* Click through the installation
* Result: the installation finishes and states that it was successful

Directory structure before installation. Please note the mysql symlink.
0 drwxr-xr-x   mariadb-5.1
0 drwxrwxr-x   mariadb-5.1.49-osx10.6-x86
0 drwxr-xr-x   mariadb-5.2
0 drwxr-xr-x   mariadb-5.2-debug
0 drwxr-xr-x   mariadb-5.3
4 lrwxr-xr-x   mysql -> mariadb-5.1.49-osx10.6-x86

Directory structure after the installation. Please note that the mysql symlink was not backuped like documented.

0 drwxr-xr-x   mariadb-5.1
0 drwxrwxr-x   mariadb-5.1.49-osx10.6-x86
0 drwxr-xr-x   mariadb-5.2
0 drwxr-xr-x   mariadb-5.2-debug
0 drwxr-xr-x   mariadb-5.3
4 lrwxr-xr-x   mysql -> mysql-5.1.50-osx10.6-x86_64
0 drwxr-xr-x   mysql-5.1.50-osx10.6-x86_64

Suggested fix:
The script preflight has a bug checking for existing mysql symlinks.

preflight reads:
PREFIX="/usr/local/mysql"
BASENAME=`basename $PREFIX`

if [ -d $PREFIX -a ! -L $PREFIX -a $BASENAME = "mysql" ] ; then
	mv $PREFIX $PREFIX.bak
fi

It should read (there is a ! too much):
PREFIX="/usr/local/mysql"
BASENAME=`basename $PREFIX`

if [ -d $PREFIX -a -L $PREFIX -a $BASENAME = "mysql" ] ; then
	mv $PREFIX $PREFIX.bak
fi
[27 Aug 2010 16:29] Valeriy Kravchuk
What installation document do you mean? 

http://dev.mysql.com/doc/refman/5.1/en/mysql-installation-macosx-pkg.html, for example, does not mention renaming existing mysql directory (or symlink) to mysql.bak (and this renaming, indeed, never happens).
[27 Aug 2010 16:33] Hakan Küçükyılmaz
I mean the documentation delivered within the installer.
[28 Aug 2010 9:48] Valeriy Kravchuk
Indeed, ReadMe.txt in .dmg claims this:

"If a directory named `/usr/local/mysql' exists, it is renamed to `/usr/local/mysql.bak' first."

while this never happens.
[28 Aug 2010 20:03] Giuseppe Maxia
The behavior in the readme.txt is consistent with what happens.

"If a *directory* named `/usr/local/mysql' exists, it is renamed to `/usr/local/mysql.bak'"

Notice: a directory, not a symlink.

Before the installation:
# ls -l -d mysql
drwxr-xr-x  2 root  wheel  68 Aug 28 21:56 mysql

This is a directory, not a symlink.

After the installation:
# ls -l -d mysql*
lrwxr-xr-x   1 root  wheel   24 Aug 28 21:58 mysql -> mysql-5.1.48-osx10.6-x86
drwxr-xr-x   2 root  wheel  136 Jun 23 07:44 mysql-5.1.38-osx10.5-x86
drwxr-xr-x  13 root  wheel  578 Jun  4 20:22 mysql-5.1.48-osx10.6-x86
drwxr-xr-x   2 root  wheel   68 Aug 28 21:56 mysql.bak

So, the installer does what the documentation says. Hence, it is not a bug.
[29 Aug 2010 17:25] Hakan Küçükyılmaz
Giuseppe, thanks for clarification.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.