Server leaves empty file named "0" on shutdown

Bug #1718998 reported by Ken Zalewski on 2017-09-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to
Status tracked in 5.7
Fix Released

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:

if [ $ret > 0 ]; then
  exit $ret

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
Revision history for this message
EvgeniyPatlan (evgeniy-patlan) wrote :
Changed in percona-server:
status: New → Fix Committed
tags: added: i215049
Revision history for this message
Sveta Smirnova (svetasmirnova) wrote :

Looks like fix for this one was pushed into main tree and creates another bug:

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Evgeniy, please set the milestone for this bug

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers