Server leaves empty file named "0" on shutdown
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Invalid
|
Undecided
|
EvgeniyPatlan | |||
5.6 |
Invalid
|
Undecided
|
EvgeniyPatlan | |||
5.7 |
Fix Released
|
Medium
|
EvgeniyPatlan |
Bug Description
Today, during a restart of Percona Server, I noticed an empty file with the filename "0" (as in, the digit zero) in the directory where I had started the server.
I deleted the file, but it kept reappearing every time I would shut down the server.
I was able to trace this to the mysqld_safe startup script. It seems that Percona made a minor change to this script from the Oracle version. The change unfortunately contains a programming error that causes this problem.
On line 219 of mysqld_safe, the code reads:
if [ $ret > 0 ]; then
The proper way to test for greater-than in the shell is using -gt, such as:
if [ $ret -gt 0 ]; then
Otherwise, the ">" operator actually writes a file named "0", which is exactly the behavior that I am seeing.
This problem does not happen in the Oracle version of mysqld_safe, because it does not contain 4 lines of code that Percona added to the eval_log_error() function, as follows:
ret=$?
if [ $ret > 0 ]; then
exit $ret
fi
Those additional 4 lines are not present in the original Oracle version of mysqld_safe.
If Percona intends to keep the 4 lines of code, the conditional must be fixed to prevent the "0" file from being written.
tags: | added: pkg |
tags: | added: low-hanging-fruit |
Changed in percona-server: | |
assignee: | nobody → EvgeniyPatlan (evgeniy-patlan) |
importance: | Undecided → Medium |
tags: | added: i215049 |
https:/ /github. com/percona/ percona- server/ pull/1938