From 64094e12c0e265e4e41ff1d780598ba945344dc6 Mon Sep 17 00:00:00 2001 From: Christian Hammers Date: Tue, 10 Apr 2018 19:31:18 +0300 Subject: [PATCH] Apply debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch We have carried along this patch as a patch inside our sources since 2012 (commit cfd4fcb0bc3d469dfca74dae30d17250d65fdd91). This same patch has been used also in MySQL packaging at Oracle and in downstream Debian.org packages for both MySQL and MariaDB. The validity of this has thus been vetted in production for years and the review done now did not find otherwise. Code contributed to Oracle with http://forge.mysql.com/wiki/Sun_Contributor_Agreement Reported as http://bugs.mysql.com/bug.php?id=31361 --- debian/patches/00list | 1 - ...38_scripts__mysqld_safe.sh__signals.dpatch | 43 ------------------- scripts/mysqld_safe.sh | 10 ++++- 3 files changed, 8 insertions(+), 46 deletions(-) delete mode 100755 debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 547a0c5ef64..4ec44da5783 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,2 +1 @@ -38_scripts__mysqld_safe.sh__signals.dpatch 61_replace_dash_with_bash_mbug675185.dpatch diff --git a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch deleted file mode 100755 index 5cbc897c272..00000000000 --- a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch +++ /dev/null @@ -1,43 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## 38_scripts__mysqld_safe.sh__signals.dpatch by -## -## All lines beginning with `## DP:' are a description of the patch. -## DP: Executes /etc/init.d/mysql on signals -## DP: Reported as http://bugs.mysql.com/bug.php?id=31361 - -@DPATCH@ - ---- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000 -+++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000 -@@ -36,7 +36,6 @@ skip_err_log=0 - syslog_tag_mysqld=mysqld - syslog_tag_mysqld_safe=mysqld_safe - --trap '' 1 2 3 15 # we shouldn't let anyone kill us - - # MySQL-specific environment variable. First off, it's not really a umask, - # it's the desired mode. Second, it follows umask(2), not umask(3) in that -@@ -181,7 +180,7 @@ eval_log_error () { - # sed buffers output (only GNU sed supports a -u (unbuffered) option) - # which means that messages may not get sent to syslog until the - # mysqld process quits. -- cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error" -+ cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error & wait" - ;; - *) - echo "Internal program error (non-fatal):" \ -@@ -895,6 +894,13 @@ then - fi - - # -+# From now on, we catch signals to do a proper shutdown of mysqld -+# when signalled to do so. -+# -+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf refresh & wait' 1 # HUP -+trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf shutdown' 2 3 15 # INT QUIT and TERM -+ -+# - # Uncomment the following lines if you want all tables to be automatically - # checked and repaired during startup. You should add sensible key_buffer - # and sort_buffer values to my.cnf to improve check performance or require - diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 5797bdc68d7..2abdfd7faf5 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -36,7 +36,6 @@ skip_err_log=0 syslog_tag_mysqld=mysqld syslog_tag_mysqld_safe=mysqld_safe -trap '' 1 2 3 15 # we shouldn't let anyone kill us # MySQL-specific environment variable. First off, it's not really a umask, # it's the desired mode. Second, it follows umask(2), not umask(3) in that @@ -160,7 +159,7 @@ eval_log_error () { # sed buffers output (only GNU sed supports a -u (unbuffered) option) # which means that messages may not get sent to syslog until the # mysqld process quits. - cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error" + cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error & wait" ;; *) echo "Internal program error (non-fatal):" \ @@ -877,6 +876,13 @@ then exit 1 fi +# +# From now on, we catch signals to do a proper shutdown of mysqld +# when signalled to do so. +# +trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf refresh & wait' 1 # HUP +trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf shutdown' 2 3 15 # INT QUIT and TERM + # # Uncomment the following lines if you want all tables to be automatically # checked and repaired during startup. You should add sensible key_buffer