You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/03/14 01:57:27 UTC

svn commit: r1456300 - /incubator/mesos/trunk/src/scripts/killtree.sh

Author: vinodkone
Date: Thu Mar 14 00:57:27 2013
New Revision: 1456300

URL: http://svn.apache.org/r1456300
Log:
Fixed killtree to guard against session ids being reported as '0'
by '/bin/ps' on OSX 10.8.

Review: https://reviews.apache.org/r/9915

Modified:
    incubator/mesos/trunk/src/scripts/killtree.sh

Modified: incubator/mesos/trunk/src/scripts/killtree.sh
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/scripts/killtree.sh?rev=1456300&r1=1456299&r2=1456300&view=diff
==============================================================================
--- incubator/mesos/trunk/src/scripts/killtree.sh (original)
+++ incubator/mesos/trunk/src/scripts/killtree.sh Thu Mar 14 00:57:27 2013
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+# We unset the DYLD_LIBRARY_PATH environment variable because the
+# dynamic linker on OSX 10.8 complains if this path is set when
+# running setuid or setgid programs, e.g., /bin/ps used in this
+# script.
+unset DYLD_LIBRARY_PATH
+
 PID=
 SIGNAL="TERM"
 KILLGROUPS=0
@@ -189,7 +195,9 @@ killtree() {
 	# First get the process session id.
         MYPSID=$(ps axo pid,sess | awk '{ if ($1 == '${MYPID}') print $2 }')
 
-	if [[ ! -z ${MYPSID} ]]; then
+	# We check for session id not being "0", because on OSX 10.8
+	# the session id of all processes as reported by 'ps' is "0"!
+	if [[ ${MYPSID} -ne "0" && ! -z ${MYPSID} ]]; then
             # Now get all members.
             SESSPIDS=$(ps axo sess,pid \
                 | awk '{ if ($1 == "'${MYPSID}'") print $2 }')