Bug #5878 ps xa | ... in mysqld_safe cut off at 52 chars on Red Hat 7.3
Submitted: 4 Oct 2004 12:51 Modified: 11 Jan 2005 20:18
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:all OS:Linux (Red Hat Linux 7.3)
Assigned to: Jim Winstead CPU Architecture:Any

[4 Oct 2004 12:51] Matthew Lord
Description:
I think this may be a bug with procps version 2.0.7 which RedHat 7.3 uses but ps xa gets cut off 
at 52 characters even though there is no controlling terminal.

I just want to know why we do not use ps xaww to be safe?  The problem is that we are 
eventually grepping for the port number or pid-file which gets cut off:

numofproces=`ps xa | grep -v "grep" | grep $ledir/$MYSQLD| grep -c "port=$mysql_tcp_port"`
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n 
'$p'`

How to repeat:
Using RedHat 7.3 or procps version 2.0.7 on linux, issue both of these while mysqld is running:

numofproces=`ps xa | grep -v "grep" | grep $ledir/$MYSQLD| grep -c "port=$mysql_tcp_port"`
PROC=`ps xa | grep "$ledir/$MYSQLD\>" | grep -v "grep" | grep "pid-file=$pid_file" | sed -n 
'$p'`

Suggested fix:
Use ps xaww unless there is a good reason not to.
[4 Jan 2005 0:54] Jim Winstead
I tested against all of the Linux boxes we have around (this code is only used on Linux), and 'ps 
xaww' behaves as expected. There may be an oddball Linux distribution that doesn't use procps, 
and might not like this syntax, but it is more likely that it would not like 'ps xa' and 'ps xaww' 
than just 'ps xaww'. (For example, if it has a SysV-ish 'ps' command.)
[11 Jan 2005 20:18] Paul DuBois
Mentioned in 4.1.9 change notes.