Commit e5a9a7bb authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Bug#51502: building with cmake creates an invalid mysqld_safe.

The problem was incorrect escaping used inside a strnig : in \"$MYSQLD\" was written as "\MYSQL\" 
(backslash and quote characters transposed), when defining FIND_PROC  variable for BSD or SysV
style "ps" command-

Additionally fixed obvious code duplication and random naming in CHECK_PID test.
parent 684f4c3c
...@@ -105,7 +105,7 @@ IF(NOT FIND_PROC) ...@@ -105,7 +105,7 @@ IF(NOT FIND_PROC)
EXECUTE_PROCESS(COMMAND ps -uaxww OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result) EXECUTE_PROCESS(COMMAND ps -uaxww OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0) IF(result MATCHES 0)
SET( FIND_PROC SET( FIND_PROC
"ps -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- "\$MYSQLD\" | grep \" $PID \" > /dev/null") "ps -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" | grep \" $PID \" > /dev/null")
ENDIF() ENDIF()
ENDIF() ENDIF()
...@@ -113,20 +113,15 @@ IF(NOT FIND_PROC) ...@@ -113,20 +113,15 @@ IF(NOT FIND_PROC)
# SysV style # SysV style
EXECUTE_PROCESS(COMMAND ps -ef OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result) EXECUTE_PROCESS(COMMAND ps -ef OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result MATCHES 0) IF(result MATCHES 0)
SET( FIND_PROC "ps -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- "\$MYSQLD\" | grep \" $PID \" > /dev/null") SET( FIND_PROC "ps -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"$MYSQLD\" | grep \" $PID \" > /dev/null")
ENDIF() ENDIF()
ENDIF() ENDIF()
EXECUTE_PROCESS(COMMAND sh -c "kill -0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result2) EXECUTE_PROCESS(COMMAND sh -c "kill -0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result)
IF(result3 MATCHES 0) IF(result MATCHES 0)
SET(CHECK_PID "kill -0 $PID > /dev/null 2> /dev/null") SET(CHECK_PID "kill -0 $PID > /dev/null 2> /dev/null")
ELSE() ELSE()
EXECUTE_PROCESS(COMMAND sh -c "kill -s 0 $$" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE result3)
IF(result4 MATCHES 0)
SET(CHECK_PID "kill -s 0 $PID > /dev/null 2> /dev/null")
ELSE()
SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null") SET(CHECK_PID "kill -s SIGCONT $PID > /dev/null 2> /dev/null")
ENDIF()
ENDIF() ENDIF()
ENDIF(UNIX) ENDIF(UNIX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment