From: Date: July 26 2007 12:58pm Subject: bk commit into 5.0 tree (jperkin:1.2478) BUG#28585 List-Archive: http://lists.mysql.com/commits/31608 X-Bug: 28585 Message-Id: <200707261058.l6QAw2L1006340@production.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of jperkin. When jperkin does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-07-26 12:57:46+02:00, jperkin@stripped +2 -0 Clean up the mysql_install_db script to ensure that a sane environment is available and reduce the chance of failure. This should fix bug#28585 which is caused by the script being quite random in how it finds files it requires and not giving very good feedback to the user about what went wrong. Also update make_binary_distribution so that it provides the correct path to the required SQL scripts when generating mysql_install_db. The script only previously worked because of the permissive behaviour which looked around the current working directory before the "correct" location. This could lead to severe problems if the user happened to run the script from a location which contained older or even broken copies of the SQL scripts. We now require either a complete binary release (and the mysql_install_db script ran from inside the extracted archive), or an installed compiled tree, as this is the only way we can be sure everything that we need is available and ready to run. While working on this fix, also clean up the mysql_install_db script a lot to make it simpler, easier to read, and hopefully less prone to bugs in the future. scripts/make_binary_distribution.sh@stripped, 2007-07-26 11:03:13+02:00, jperkin@stripped +1 -1 SQL files live in ./share not ./support-files in binary distribution. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:43:09+02:00, jperkin@stripped +15 -10 Use a consistent shell indentation style. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:40:12+02:00, jperkin@stripped +1 -3 Missed $mysqld_opt in the previous commit. Add some more comments. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:38:10+02:00, jperkin@stripped +0 -8 Don't bother initialising string variables. Due to the way the script is constructed, this needs to be done in two different places if done at all, and as we quote all variables correctly now there's no real reason to do it at all. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:31:43+02:00, jperkin@stripped +3 -3 Be consistent in how we echo a null string. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:28:58+02:00, jperkin@stripped +10 -13 No need to test for $fill_help_tables again, we already did that. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:25:52+02:00, jperkin@stripped +6 -5 Standardise on numerical comparison instead of mixing both numeric and string. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:23:20+02:00, jperkin@stripped +9 -9 Make sure all variables and strings are properly quoted. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:17:52+02:00, jperkin@stripped +1 -4 $scriptdir isn't used anywhere, remove it. $ip is useless, remove it. scripts/mysql_install_db.sh@stripped, 2007-07-26 12:09:21+02:00, jperkin@stripped +18 -19 Simplify search for mysqld, and give more feedback to the user if we hit failure with the supplied --basedir. No need to duplicate the 'make install' suggestion as we now do that as soon as possible by checking for my_print_defaults. scripts/mysql_install_db.sh@stripped, 2007-07-26 11:50:23+02:00, jperkin@stripped +14 -40 Look for the SQL bootstrap files either in the supplied --srcdir argument or within the installed compile/binary release. Anything else could lead to problems by finding older/broken copies. The make_binary_distribution script is now fixed to look in the correct place for binary releases. scripts/mysql_install_db.sh@stripped, 2007-07-26 11:35:37+02:00, jperkin@stripped +12 -15 Ensure we can use the correct my_print_defaults for the chosen installation method (binary release or source compile) and do not try and rely on $PATH as a fallback as that will only lead to confusion later on when things aren't where we expect them to be. Debian reverted back from using "mysql_print_defaults" a long time ago so we don't need to check for that as well. scripts/mysql_install_db.sh@stripped, 2007-07-26 11:29:42+02:00, jperkin@stripped +12 -15 Remove more copy+paste, iterate over database directories instead. scripts/mysql_install_db.sh@stripped, 2007-07-26 11:13:51+02:00, jperkin@stripped +9 -4 Reduce copy+paste programming, add parse_arg() to handle grabbing long-option arguments. scripts/mysql_install_db.sh@stripped, 2007-07-26 11:09:53+02:00, jperkin@stripped +34 -0 Display usage text via --help diff -Nrup a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh --- a/scripts/make_binary_distribution.sh 2007-07-21 01:53:15 +02:00 +++ b/scripts/make_binary_distribution.sh 2007-07-26 11:03:13 +02:00 @@ -318,7 +318,7 @@ if [ $BASE_SYSTEM != "netware" ] ; then copyfileto $BASE/bin scripts/* $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ \ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ \ - @HOSTNAME@ \@pkgdatadir\@ ./support-files \ + @HOSTNAME@ \@pkgdatadir\@ ./share \ < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \ \@sbindir\@ ./bin \@libexecdir\@ ./bin \ diff -Nrup a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh --- a/scripts/mysql_install_db.sh 2007-04-28 01:48:53 +02:00 +++ b/scripts/mysql_install_db.sh 2007-07-26 12:43:09 +02:00 @@ -18,26 +18,65 @@ # # All unrecognized arguments to this script are passed to mysqld. +force=0 in_rpm=0 +ip_only=0 windows=0 -defaults="" -user="" case "$1" in - --no-defaults|--defaults-file=*|--defaults-extra-file=*) - defaults="$1"; shift - ;; + --no-defaults|--defaults-file=*|--defaults-extra-file=*) + defaults="$1"; shift + ;; esac +usage() +{ + cat <&1` if [ $? -ne 0 ] @@ -244,39 +247,35 @@ then fi fi -if test "$ip_only" = "1" +if test "$ip_only" -eq 1 then - ip=`echo "$resolved" | awk '/ /{print $6}'` - hostname=$ip + hostname=`echo "$resolved" | awk '/ /{print $6}'` fi # Create database directories mysql & test -if test ! -d $ldata; then - mkdir $ldata; - chmod 700 $ldata ; -fi -if test ! -d $ldata/mysql; then - mkdir $ldata/mysql; - chmod 700 $ldata/mysql ; -fi -if test ! -d $ldata/test; then - mkdir $ldata/test; - chmod 700 $ldata/test ; -fi -if test -w / -a ! -z "$user"; then - chown $user $ldata $ldata/mysql $ldata/test; -fi +for dir in $ldata $ldata/mysql $ldata/test +do + if test ! -d $dir + then + mkdir -p $dir + chmod 700 $dir + fi + if test -w / -a ! -z "$user" + then + chown $user $dir + fi +done -if test -n "$user"; then +if test -n "$user" +then args="$args --user=$user" fi # Peform the install of system tables mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ ---basedir=$basedir --datadir=$ldata --skip-innodb \ ---skip-bdb --skip-ndbcluster $args --max_allowed_packet=8M \ ---net_buffer_length=16K" + --basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \ + --skip-ndbcluster $args --max_allowed_packet=8M --net_buffer_length=16K" # Pipe mysql_system_tables.sql to "mysqld --bootstrap" s_echo "Installing MySQL system tables..." @@ -284,23 +283,20 @@ if `(echo "use mysql;"; cat $create_syst then s_echo "OK" - if test -n "$fill_help_tables" + s_echo "Filling help tables..." + # Pipe fill_help_tables.sql to "mysqld --bootstrap" + if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line` then - s_echo "Filling help tables..." - # Pipe fill_help_tables.sql to "mysqld --bootstrap" - if `(echo "use mysql;"; cat $fill_help_tables) | $mysqld_install_cmd_line` - then - # Fill suceeded - s_echo "OK" - else - echo "" - echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" - echo "The \"HELP\" command might not work properly" - echo "" - fi + # Fill suceeded + s_echo "OK" + else + echo + echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" + echo "The \"HELP\" command might not work properly" + echo fi - s_echo "" + s_echo s_echo "To start mysqld at boot time you have to copy" s_echo "support-files/mysql.server to the right place for your system" s_echo @@ -319,7 +315,7 @@ then echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "See the manual for more instructions." - if test "$in_rpm" = "0" + if test "$in_rpm" -eq 0 then echo "You can start the MySQL daemon with:" echo "cd @prefix@ ; $bindir/mysqld_safe &"