From a56e29704e0cbdef719462feff2db85ee3237076 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Mon, 26 Aug 2013 17:45:02 -0700
Subject: [PATCH] Make sure that /bin/bash exists before attempting to chroot.

---
 util/m | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/m b/util/m
index 4ec11f32..860eeb05 100755
--- a/util/m
+++ b/util/m
@@ -35,9 +35,9 @@ fi
 
 # Check whether host should be running in a chroot dir
 rootdir="/var/run/mn/$host/root"
-if [ -d $rootdir ]; then
+if [ -d $rootdir -a -x $rootdir/bin/bash ]; then
     cmd="'cd `pwd`; exec $cmd'"
-    cmd="chroot $rootdir bash -c $cmd"
+    cmd="chroot $rootdir /bin/bash -c $cmd"
 fi
 
 cmd="exec sudo mnexec -a $pid $cg $cmd"
-- 
GitLab