#At file:///Users/cmiller/work/mysqlbzr/5.0-bugteam--bug11122/
2653 Chad MILLER 2008-08-05
Bug#11122: Server won't always start when cold-booting after a crash
The grep expression that finds a running "mysqld" program fails if the
"mysqld_safe" is running with the same PID.
Now, match "msyqld" at the end of a line or before a space only. This
also has the effect of the matcher expression never matching itself, as
the metacharacters don't describe themselves.
Additionally, some text to search could be truncated if very long.
modified:
configure.in
=== modified file 'configure.in'
--- a/configure.in 2008-07-19 03:46:03 +0000
+++ b/configure.in 2008-08-05 17:41:44 +0000
@@ -504,46 +504,54 @@ then
fi
AC_SUBST(ICHECK)
-# Lock for PS
+# Look for PS usage. We use double dollar-signs in FIND_PROC because this
+# value is written to a makefile, which interprets away one level of
+# dollar-signs. So, interpretation stages are m4 and then shell in autoconf,
+# then Make, then shell .
+#
+# We use grep -E Foo space-or-EOL so that we don't falsely match "Foo_safe" .
+# Assumption is that if there are parameters, the system represents them using
+# space as a seperator. This has the side effect that the matching expression
+# does not match itself, and so grep won't self-match.
AC_PATH_PROG(PS, ps, ps)
AC_MSG_CHECKING("how to check if pid exists")
PS=$ac_cv_path_PS
# Linux style
-if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
+if $PS wwwwp $$ 2> /dev/null | grep -E -- "$0( |\$)" > /dev/null
then
- FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS wwwp \$\$PID | grep -E -- \"\$\$MYSQLD( |\$\$)\" > /dev/null"
# Solaris
-elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
+elif $PS -fwwwp $$ 2> /dev/null | grep -E -- "$0( |\$)" > /dev/null
then
- FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS -wwwp \$\$PID | grep -E -- \"\$\$MYSQLD( |\$\$)\" > /dev/null"
# BSD style
-elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
+elif $PS -uaxww 2> /dev/null | grep -E -- "$0( |\$)" > /dev/null
then
- FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -uaxww | grep -E -- \"\$\$MYSQLD( |\$\$)\" | grep \" \$\$PID \" > /dev/null"
# SysV style
-elif $PS -ef 2> /dev/null | grep $0 > /dev/null
+elif $PS -ef 2> /dev/null | grep -E -- "$0( |\$)" > /dev/null
then
- FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -ef | grep -E -- \"\$\$MYSQLD( |\$\$)\" | grep \" \$\$PID \" > /dev/null"
# Do anybody use this?
-elif $PS $$ 2> /dev/null | grep $0 > /dev/null
+elif $PS $$ 2> /dev/null | grep -E -- "$0( |\$)" > /dev/null
then
- FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS \$\$PID | grep -E -- \"\$\$MYSQLD( |\$\$)\" > /dev/null"
else
case $SYSTEM_TYPE in
*freebsd*|*dragonfly*)
- FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
+ FIND_PROC="$PS p \$\$PID | grep -E -- \"\$\$MYSQLD( |\$\$)\" > /dev/null"
;;
*darwin*)
- FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -uaxww | grep -E -- \"\$\$MYSQLD( |\$\$)\" | grep \" \$\$PID \" > /dev/null"
;;
*cygwin*)
- FIND_PROC="$PS -e | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
+ FIND_PROC="$PS -e | grep -E -- \"\$\$MYSQLD( |\$\$)\" | grep \" \$\$PID \" > /dev/null"
;;
*netware*)
FIND_PROC=
;;
*)
- AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
+ AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.])
esac
fi
AC_SUBST(FIND_PROC)