Bug in /usr/share/mysql/mysql-systemd-start script

Bug #1735930 reported by Brian Pape
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mysql-5.7 (Ubuntu)
Fix Released
High
Unassigned
Xenial
Won't Fix
Undecided
Unassigned
Artful
Won't Fix
Undecided
Unassigned

Bug Description

Bug in script; does not properly print error message or exit with correct exit code when mysqld server is not running when executed with "post" argument.

expected behavior:
when script is called with argument "post", exit with correct exit code and print error message when mysqld is not running

actual behavior:
execution drops off end of script with exit code of 0 and no message printed

reason:
script is using test builtin ('[') and doing a string comparison (obvious from diff) rather than executing the 'false' builtin.

release:
Description: Ubuntu 17.10
Release: 17.10

NOTE: launchpad says:
"mysql-server-5.7" does not exist in Ubuntu. Please choose a different package.
My only choice is "mysql-5.7" (which is clearly not what dpkg-query or apt-cache report!)

package:

# dpkg-query -S /usr/share/mysql/mysql-systemd-start
mysql-server-5.7: /usr/share/mysql/mysql-systemd-start

# apt-cache policy mysql-server-5.7
mysql-server-5.7:
  Installed: 5.7.20-0ubuntu0.17.10.1
  Candidate: 5.7.20-0ubuntu0.17.10.1
  Version table:
 *** 5.7.20-0ubuntu0.17.10.1 500
        500 http://us.archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu artful-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.7.19-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu artful/main amd64 Packages

PATCH:

# diff -u /usr/share/mysql/mysql-systemd-start*
--- /usr/share/mysql/mysql-systemd-start 2017-01-16 03:13:03.000000000 -0800
+++ /usr/share/mysql/mysql-systemd-start.fixed 2017-12-02 08:53:31.779140503 -0800
@@ -46,7 +46,7 @@
       break
     fi
   done
- if [ ! $server_up ]; then
+ if ! $server_up ; then
     echo "MySQL server not started"
     exit 1
   fi

Tags: patch artful
tags: added: artful patch
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This totally LGTM
minimized showcase

$ cat test.sh
#!/bin/bash
echo ORIG
server_up=false
if [ ! $server_up ]; then
  echo "not false = true"
fi
server_up=true
if [ ! $server_up ]; then
  echo "not true = true"
fi
echo FIX
server_up=false
if ! $server_up; then
  echo "not false = true"
fi
server_up=true
if ! $server_up; then
  echo "not true = true"
fi

$ ./test.sh
ORIG
FIX
not false = true

Changed in mysql-5.7 (Ubuntu):
status: New → Triaged
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Lars / Robie - I set triaged, but please confirm that this is on any of your task lists to be picked up.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I know a merge is currently ongoing but not yet complete for Bionic - maybe it could be picked up there.

Robie Basak (racb)
Changed in mysql-5.7 (Ubuntu):
milestone: none → ubuntu-17.12
Robie Basak (racb)
Changed in mysql-5.7 (Ubuntu):
importance: Undecided → High
Revision history for this message
Lars Tangvald (lars-tangvald) wrote :

The "post" operation for mysql-systemd-start has actually been removed completely in the bionic merge; The systemd unit now uses the --daemonize option (server process forks when ready) and Type=forking

Robie Basak (racb)
Changed in mysql-5.7 (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

I am marking the trackers for xenial and artful as wontfix, since these series are no longer under standard support.

Changed in mysql-5.7 (Ubuntu Artful):
status: New → Won't Fix
Changed in mysql-5.7 (Ubuntu Xenial):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.