Bug in /usr/share/mysql/mysql-systemd-start script
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-server-5.7: /usr/share/
# apt-cache policy mysql-server-5.7
mysql-server-5.7:
Installed: 5.7.20-
Candidate: 5.7.20-
Version table:
*** 5.7.20-
500 http://
500 http://
100 /var/lib/
5.
500 http://
PATCH:
# diff -u /usr/share/
--- /usr/share/
+++ /usr/share/
@@ -46,7 +46,7 @@
break
fi
done
- if [ ! $server_up ]; then
+ if ! $server_up ; then
echo "MySQL server not started"
exit 1
fi
tags: | added: artful patch |
Changed in mysql-5.7 (Ubuntu): | |
milestone: | none → ubuntu-17.12 |
Changed in mysql-5.7 (Ubuntu): | |
importance: | Undecided → High |
Changed in mysql-5.7 (Ubuntu): | |
status: | Triaged → Fix Released |
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