Bug #30954 "configure" script in binary distributions considered harmfull
Submitted: 11 Sep 2007 14:36 Modified: 18 Dec 2009 11:46
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:5.0.45 OS:Any
Assigned to: Jonathan Perkin CPU Architecture:Any

[11 Sep 2007 14:36] Hartmut Holzgraefe
Description:
The configure script bundled with our binary packes does 
something completely different to what you'd usually expect 
from a configure file.

#1 - it initializes and starts a local server instance without asking

#2 - it does so even when trying a "configure --help"

Point #1 is something i simply don't like as it violates
the "no surprises" principle. A script like this is usefull
for binary distributions, but IMHO it should be given a different
name like e.g. "quickstart"

Point #2 i consider a bug, "configure --help" should *never*
do anything else besides printing useage information.

How to repeat:
Download a binary releae tarball, unpack it, run the configure script that came with it.

I tried with mysql-5.0.45-linux-i686.tar.gz and mysql-5.0.45-solaris10-sparc.tar.gz ...

Suggested fix:
- make the script parse the --help option
- rename the script to something like "quickstart" or at least have it ask for confirmation after printing its message and before doing anything else
[11 Sep 2007 14:37] Hartmut Holzgraefe
Actual output of "configure" bundled with binary tarballs is:

-bash-3.00$ cd mysql-5.0.45-solaris10-sparc-64bit
-bash-3.00$ ./configure 
NOTE: This is a MySQL binary distribution. It's ready to run, you don't
need to configure it!

To help you a bit, I am now going to create the needed MySQL databases
and start the MySQL server for you.  If you run into any trouble, please
consult the MySQL manual, that you can find in the Docs directory.

Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sol10-sparc-c password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Starting the mysqld server.  You can test that it is up and running
with the command:
./bin/mysqladmin version
[11 Sep 2007 14:59] Valeriy Kravchuk
The script is the following:

#!/bin/sh
if test ! -x  ./scripts/mysql_install_db
then
  echo "I didn't find the script './scripts/mysql_install_db'."
  echo "Please execute this script in the mysql distribution directory!"
  exit 1;
fi

echo "NOTE: This is a MySQL binary distribution. It's ready to run, you don't"
echo "need to configure it!"
echo ""
echo "To help you a bit, I am now going to create the needed MySQL databases"
echo "and start the MySQL server for you.  If you run into any trouble, please"
echo "consult the MySQL manual, that you can find in the Docs directory."
echo ""

./scripts/mysql_install_db --no-defaults
if [ $? = 0 ]
then
  echo "Starting the mysqld server.  You can test that it is up and running"
  echo "with the command:"
  echo "./bin/mysqladmin version"
  ./bin/mysqld_safe --no-defaults &
fi

As you can see, nobody checks for --help here :)
[10 Jan 2008 13:24] 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/40839

ChangeSet@1.2590, 2008-01-10 13:24:04+00:00, jperkin@chorlton.adsl.perkin.org.uk +1 -0
  bug#30954: add usage, handle command line options.
[10 Jan 2008 13:28] Jonathan Perkin
For 5.0 I would prefer to be conservative and keep the behaviour/name of the script the same, just adding support for --help as I have done above.

For 5.1+, I plan to:
  a) pull up 5.0 change
  b) rename the script, users will assume "configure" is the GNU autoconf script, leading to confusion
  c) change the default behaviour to output what the script will do, and add a --force or -y option to get it to actually run the commands
[10 Jan 2008 13:34] 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/40840

ChangeSet@1.2591, 2008-01-10 13:34:41+00:00, jperkin@chorlton.adsl.perkin.org.uk +1 -0
  bug#30954: small shell nit
[3 Mar 2008 22:22] Timothy Smith
5.0 change is fine.  I'd like to see the 5.1+ change before approving.

I think that, if the script is renamed to something like 'quickstart', then it's OK to actually perform the actions without a --force flag.
[4 Mar 2008 12:56] Jonathan Perkin
It looks as though the 'make install' changes for make_binary_distribution mean that on 5.1+ this script is already installed as support-files/binary-configure instead of ./configure, so that part has already been resolved, although perhaps not intended!

As for --force, I'm happy to drop that and have the script behave the same on all versions.  Given the limited scope, I think this is fine.

Therefore for 5.1+ I now propose to simply pull up the 5.0 change.
[14 Apr 2008 18:49] Joerg Bruehe
The change to 5.0 is ok (combination of both changesets),
even though I would not use the same exit code (2) for both an expected "usage" (--help) exit and that caused by an erroneous (unexpected) argument.

Regarding 5.1, I don't consider "binary-configure" to be a nice name, but it is not so bad that I want to change it again (less change for the users).

So IMO, merging the 5.0 change up is sufficient.
[15 Apr 2008 9:33] 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/45418

ChangeSet@1.2591, 2008-04-15 10:32:50+01:00, jperkin@chorlton.adsl.perkin.org.uk +1 -0
  bug#30954: small shell nit, fix exit code of --help|-h
[28 Sep 2009 18:16] Jonathan Perkin
Fix pushed to mysql-5.0-bugteam => mysql-5.1-bugteam => mysql-pe
[6 Oct 2009 8:57] Bugs System
Pushed into 5.0.87 (revid:joro@sun.com-20091006073202-rj21ggvo2gw032ks) (version source revid:kristofer.pettersson@sun.com-20090929151855-gvpblm4dnnubypdv) (merge vers: 5.0.87) (pib:11)
[6 Oct 2009 8:59] Bugs System
Pushed into 5.1.40 (revid:joro@sun.com-20091006073316-lea2cpijh9r6on7c) (version source revid:jperkin@sun.com-20090928163214-2xsegci0rbpfemk7) (merge vers: 5.1.40) (pib:11)
[13 Oct 2009 10:00] MC Brown
A note has been added to the 5.0.87 and 5.1.40 changelogs: 

In binary installations of MySQL, the supplied <command>configure</command> script would start and configure MySQL, even when request help on the command with the <option>--help</option> command-line option. The name of the tool has changed to <command>configure-binary</command>, and the <option>--help</option>, if provided, will no longer start and install the server.
[22 Oct 2009 6:36] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091022063126-l0qzirh9xyhp0bpc) (version source revid:alik@sun.com-20091019135554-s1pvptt6i750lfhv) (merge vers: 6.0.14-alpha) (pib:13)
[22 Oct 2009 7:09] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091022060553-znkmxm0g0gm6ckvw) (version source revid:alik@sun.com-20091013094238-g67x6tgdm9a7uik0) (merge vers: 5.5.0-beta) (pib:13)
[30 Oct 2009 11:10] MC Brown
Changelog entry added to the 6.0.14 and 5.5.0 changelogs: 

In binary installations of MySQL, the supplied <command>configure</command> script would
start and configure MySQL, even when request help on the command with the
<option>--help</option> command-line option. The name of the tool has changed to
<command>configure-binary</command>, and the <option>--help</option>, if provided, will no
longer start and install the server.
[18 Dec 2009 10:38] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:54] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 10:55] MC Brown
Added entry to 5.1.41-ndb-7.1.0
[18 Dec 2009 11:08] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:23] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 11:46] MC Brown
Already documented in 5.1.41