Bug #57027 configure fails on Solaris because ps truncates the CMD
Submitted: 26 Sep 2010 21:21 Modified: 8 Oct 2010 15:37
Reporter: Nicolai Stange Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.1.51 OS:Solaris
Assigned to: CPU Architecture:Any
Tags: Contribution

[26 Sep 2010 21:21] Nicolai Stange
Description:
configure on Solaris10/SPARC gives:
"Could not find the right ps and/or grep switches. Which OS is this?  See the Installation chapter in the Reference Manual."

This happens if the path configure has been invoked with is very long:
configure's following test will fail because grep won't find the truncated CMD:
$PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null

According to 'man ps' Solaris' ps truncates after 80 bytes.

How to repeat:
Invoke configure with an absolute path of length > 80 bytes on Solaris

Suggested fix:
--- /tmp/mysql-5.1.51/configure.in      2010-09-13 15:41:54.000000000 +0200
+++ mysql-5.1.51/configure.in   2010-09-26 22:39:57.452105988 +0200
@@ -462,7 +462,7 @@
 then
   FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
 # Solaris
-elif $PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null
+elif $PS -fp $$ 2> /dev/null | grep -- `echo $0 | cut -b 1-60` > /dev/null
 then
   FIND_PROC="$PS -p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
 # BSD style
[27 Sep 2010 11:49] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with BASH on Solaris. Which shell do you use?
[27 Sep 2010 13:12] Nicolai Stange
I tried both.

My login shell ist bash if that is your question, but since there's a /bin/sh shebang at the top of configure that doesn't matter.

However, I also tried invoking the configure scripts with
/bin/sh /very/long/foo/bar/configure
and
/bin/bash /very/long/foo/bar/configure
and got the same behaviour in both cases.

The problem is really with ps truncating the CMD, not with the shell used (see 'man ps' and/or try it).
[27 Sep 2010 13:14] Nicolai Stange
Btw.: I'm on Solaris10, _not_ on OpenSolaris.
[27 Sep 2010 19:04] Sveta Smirnova
Thank you for the feedback.

Verified as described.

To repeat one should call configure with full path, i.e. /xxx/configure, so workaround is cd source directory, then run ./configure
[8 Oct 2010 15:37] Omer Barnir
Caused by a problem not under the control of the MySQL code and as a simple workaround