Bug #38082 mysql_install_db on Solaris must run as bash, not sh
Submitted: 13 Jul 2008 4:19 Modified: 13 Jul 2008 14:39
Reporter: Glenn Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.51a OS:Solaris
Assigned to: CPU Architecture:Any

[13 Jul 2008 4:19] Glenn
Description:
Running the scripts/mysql_install_db script on Solaris yields the following as the first two lines of output:

./mysql_install_db: !: not found
./mysql_install_db: !: not found

So clearly some of this code is not executing as intended.

The problem is that the script tries to run as the Bourne shell, but in fact some of the syntax it contains is particular to the Bash shell rather than the Bourne shell.  The origin of the problem is no doubt having the script originally developed under Linux, where a supposed Bourne shell is actually just implemented as a link to the Bash shell:

/bin/sh -> bash

So Linux developers are not made immediately aware when they are using functionality which is not actually supported in the shell they supposedly want the script to run under.  On Solaris, this has to be corrected by referencing the proper shell.  As such, a single fix, invoking the actual desired shell, should be portable across platforms.

How to repeat:
Run the scripts/mysql_install_db script on Solaris.

Suggested fix:
Change the first line of the scripts/mysql_install_db script from:
#!/bin/sh
to:
#!/bin/bash
[13 Jul 2008 14:39] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicate of bug #35723