summaryrefslogtreecommitdiff
path: root/support-files
diff options
context:
space:
mode:
authorunknown <joerg@mysql.com>2006-06-22 14:28:05 +0200
committerunknown <joerg@mysql.com>2006-06-22 14:28:05 +0200
commit62683b70fb3a6c386449480dd5f55da690676086 (patch)
tree0237b104390aa214f4d8baa1711bdae5e8fe3e61 /support-files
parent99740b3fb07780d1e6e04af4c56144ed3f363ebc (diff)
downloadmariadb-git-62683b70fb3a6c386449480dd5f55da690676086.tar.gz
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.
Diffstat (limited to 'support-files')
-rw-r--r--support-files/mysql.spec.sh22
1 files changed, 18 insertions, 4 deletions
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 <joerg@mysql.com>
+
+- 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 <joerg@mysql.com>
- To run "mysql_upgrade", we need a running server;