[Bug 359177] [NEW] Strange or obsolete code in mysql initscript

Alexey Sveshnikov mahoro at nm.ru
Fri Apr 10 18:27:18 BST 2009


Public bug reported:

Hi.

There is several snippets in mysql init script, with 'log_end_msg 1',
call and some code after it.

'log_end_msg' returns it's argument as exit status. So 'log_end_msg 1'
will be intrepreted by bash as command that always fails. Option '-e' in
bash causes script to bail out in case of any error.

So in this fragment:


    'stop')
          .....
          log_daemon_msg "Stopping MySQL database server" "mysqld"
          if ! mysqld_status check_dead nowarn; then
            set +e
            shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
            set -e
            if [ "$r" -ne 0 ]; then
              log_end_msg 1

All futher code will never being executed:

              [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"      
              log_daemon_msg "Killing MySQL database server by signal" "mysqld"
              killall -15 mysqld
  ...

Moreover, 'VERBOSE' variable is undefined.

So, I think this code is a little strange one. By the way, I also think
that killing all mysqld processes is not very good idea too (MySQL
Enterprise Monitor, for example, runs it's own mysqld instance that
shouldn't be killed by this init script)

I can send a patch for it if it will be helpful.

** Affects: mysql-dfsg-5.0 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: init.d initscript log-end-msg mysqld

-- 
Strange or obsolete code in mysql initscript
https://bugs.launchpad.net/bugs/359177
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to mysql-dfsg-5.0 in ubuntu.



More information about the Ubuntu-server-bugs mailing list