From 62683b70fb3a6c386449480dd5f55da690676086 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Jun 2006 14:28:05 +0200 Subject: [PATCH 1/4] Improved fix for bug#18516 (also 19353): 1) Rename the old shell tool "mysql_upgrade", to avoid a name collision. 2) Improve the spec file, to explicitly use a temporary socket. scripts/mysql_upgrade_shell.sh: Rename: scripts/mysql_upgrade.sh -> scripts/mysql_upgrade_shell.sh scripts/Makefile.am: The old shell script "mysql_upgrade" must be renamed, so that its name does not collide with the new binary. support-files/mysql.spec.sh: The previous version was incomplete, as it did not cover the case where the DBA had configured a non-default socket file. Solve that by creating and explicitly providing a temporary directory for the socket just for the duration of "mysql_upgrade", which also can be better protected than the default socket. --- scripts/Makefile.am | 6 ++--- ...ysql_upgrade.sh => mysql_upgrade_shell.sh} | 0 support-files/mysql.spec.sh | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) rename scripts/{mysql_upgrade.sh => mysql_upgrade_shell.sh} (100%) diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 0f68b484f41..a339ebc5b8f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -32,7 +32,7 @@ bin_SCRIPTS = @server_scripts@ \ mysqldumpslow \ mysql_explain_log \ mysql_tableinfo \ - mysql_upgrade \ + mysql_upgrade_shell \ mysqld_multi \ mysql_create_system_tables @@ -60,7 +60,7 @@ EXTRA_SCRIPTS = make_binary_distribution.sh \ mysql_explain_log.sh \ mysqld_multi.sh \ mysql_tableinfo.sh \ - mysql_upgrade.sh \ + mysql_upgrade_shell.sh \ mysqld_safe.sh \ mysql_create_system_tables.sh @@ -89,7 +89,7 @@ CLEANFILES = @server_scripts@ \ mysqldumpslow \ mysql_explain_log \ mysql_tableinfo \ - mysql_upgrade \ + mysql_upgrade_shell \ mysqld_multi \ make_win_src_distribution \ mysql_create_system_tables diff --git a/scripts/mysql_upgrade.sh b/scripts/mysql_upgrade_shell.sh similarity index 100% rename from scripts/mysql_upgrade.sh rename to scripts/mysql_upgrade_shell.sh diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index abd29b6014a..2f66d64b289 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -490,11 +490,19 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir # So ensure the server is isolated as much as possible, and start it so that # passwords are not checked. # See the related change in the start script "/etc/init.d/mysql". -chmod 700 $mysql_datadir -%{_sysconfdir}/init.d/mysql start --skip-networking --skip-grant-tables -%{_bindir}/mysql_upgrade +if type mktemp >/dev/null 2>&1 +then + mysql_tmp_sockdir=`mktemp -dt` +else + PID=$$ + mysql_tmp_sockdir=/tmp/mysql-$PID + ( umask 077 ; mkdir $mysql_tmp_sockdir ) +fi +chown %{mysqld_user}:%{mysqld_group} $mysql_tmp_sockdir +%{_sysconfdir}/init.d/mysql start --skip-networking --skip-grant-tables --socket=$mysql_tmp_sockdir/upgrade.sock +%{_bindir}/mysql_upgrade --socket=$mysql_tmp_sockdir/upgrade.sock %{_sysconfdir}/init.d/mysql stop --skip-networking --skip-grant-tables -chmod 755 $mysql_datadir +rm -fr $mysql_tmp_sockdir # Change permissions again to fix any new files. chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir @@ -732,6 +740,12 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Thu Jun 22 2006 Joerg Bruehe + +- Close a gap of the previous version by explicitly using + a newly created temporary directory for the socket to be used + in the "mysql_upgrade" operation, overriding any local setting. + * Tue Jun 20 2006 Joerg Bruehe - To run "mysql_upgrade", we need a running server; From 88812ad4abf961ba6455de5d980dcd51888d65a7 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 23 Jun 2006 12:17:11 +0200 Subject: [PATCH 2/4] The binary "mysql_upgrade" must be included in the distribution. (bug#18516 + 19353) scripts/make_binary_distribution.sh: The binary "mysql_upgrade" must be included in the distribution. --- scripts/make_binary_distribution.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 36c941ef6aa..74b1993882e 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -134,7 +134,7 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ client/mysqldump$BS client/mysqlimport$BS \ client/mysqltest$BS client/mysqlcheck$BS \ - client/mysqlbinlog$BS \ + client/mysqlbinlog$BS client/mysql_upgrade$BS \ tests/mysql_client_test$BS \ libmysqld/examples/mysql_client_test_embedded$BS \ libmysqld/examples/mysqltest_embedded$BS \ From d8e9dd6110c98e11181d12b4c44da3cc5c09a08d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Jun 2006 18:17:53 +0200 Subject: [PATCH 3/4] Move "mysqldumpslow" from the client RPM to the server RPM (bug#20216). --- support-files/mysql.spec.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index d11fc5ef440..5796e776b83 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -469,6 +469,7 @@ fi %attr(755, root, root) %{_bindir}/mysql_convert_table_format %attr(755, root, root) %{_bindir}/mysqld_multi %attr(755, root, root) %{_bindir}/mysqld_safe +%attr(755, root, root) %{_bindir}/mysqldumpslow %attr(755, root, root) %{_bindir}/mysql_explain_log %attr(755, root, root) %{_bindir}/mysql_fix_extensions %attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables @@ -506,7 +507,6 @@ fi %attr(755, root, root) %{_bindir}/mysqlbinlog %attr(755, root, root) %{_bindir}/mysqlcheck %attr(755, root, root) %{_bindir}/mysqldump -%attr(755, root, root) %{_bindir}/mysqldumpslow %attr(755, root, root) %{_bindir}/mysqlimport %attr(755, root, root) %{_bindir}/mysqlshow @@ -578,6 +578,10 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Tue Jun 27 2006 Joerg Bruehe + +- move "mysqldumpslow" from the client RPM to the server RPM (bug#20216) + * Sat May 20 2006 Kent Boortz - Always compile for PIC, position independent code. From 0604daa4c7f173eba5662df6aaaebf39dae6f964 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Jun 2006 20:18:03 +0200 Subject: [PATCH 4/4] Revert all previous attempts to call "mysql_upgrade" during RPM upgrade. This finishes bug#18516, as far as "generic RPMs" are concerned. support-files/mysql.spec.sh: Revert all previous attempts to call "mysql_upgrade" during RPM upgrade, there are some more aspects which need to be solved before this is possible. For now, just ensure the binary "mysql_upgrade" is delivered and installed. This finishes bug#18516, as far as "generic RPMs" are concerned. --- support-files/mysql.spec.sh | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index a452811dc91..9f08d9330d4 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -485,25 +485,7 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir # Initiate databases if needed %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} -# Upgrade databases if needed -# This must be done as database user "root", who should be password-protected, -# but this password is not available here. -# So ensure the server is isolated as much as possible, and start it so that -# passwords are not checked. -# See the related change in the start script "/etc/init.d/mysql". -if type mktemp >/dev/null 2>&1 -then - mysql_tmp_sockdir=`mktemp -dt` -else - PID=$$ - mysql_tmp_sockdir=/tmp/mysql-$PID - ( umask 077 ; mkdir $mysql_tmp_sockdir ) -fi -chown %{mysqld_user}:%{mysqld_group} $mysql_tmp_sockdir -%{_sysconfdir}/init.d/mysql start --skip-networking --skip-grant-tables --socket=$mysql_tmp_sockdir/upgrade.sock -%{_bindir}/mysql_upgrade --socket=$mysql_tmp_sockdir/upgrade.sock -%{_sysconfdir}/init.d/mysql stop --skip-networking --skip-grant-tables -rm -fr $mysql_tmp_sockdir +# Upgrade databases if needed would go here - but it cannot be automated yet # Change permissions again to fix any new files. chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir @@ -741,6 +723,12 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog +* Tue Jun 27 2006 Joerg Bruehe + +- Revert all previous attempts to call "mysql_upgrade" during RPM upgrade, + there are some more aspects which need to be solved before this is possible. + For now, just ensure the binary "mysql_upgrade" is delivered and installed. + * Thu Jun 22 2006 Joerg Bruehe - Close a gap of the previous version by explicitly using