From 8a90fdaa42941e4a9b8d27f952cef5121fbe5e9d Mon Sep 17 00:00:00 2001 From: David Scott Date: Mon, 21 Dec 2009 14:22:52 +0000 Subject: [PATCH] CA-36075: add back in a sane default $PATH for subprocesses that need it. In particular the 'EXTSR' storage backend expects to find 'pvcreate' on the path. Rather than just fixing this one instance and then seeing what else fails, this patch should prevent this class of error recurring. Note that the only place we actually pass a custom environment to a subprocess is when installing the debian etch template. Signed-off-by: David Scott --- stdext/forkhelpers.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stdext/forkhelpers.ml b/stdext/forkhelpers.ml index a5adf14..8a752af 100644 --- a/stdext/forkhelpers.ml +++ b/stdext/forkhelpers.ml @@ -21,6 +21,8 @@ (* XXX: this is a work in progress *) +let default_path = [ "/sbin"; "/usr/sbin"; "/bin"; "/usr/bin" ] + open Pervasiveext type pidty = @@ -201,7 +203,7 @@ let safe_close_and_exec ?env stdin stdout stderr (fds: (string * Unix.file_descr let env = match env with | Some e -> e - | None -> [||] + | None -> [| "PATH=" ^ (String.concat ":" default_path) |] in Fecomms.write_raw_rpc sock (Fe.Setup {Fe.cmdargs=(cmd::args); env=(Array.to_list env); id_to_fd_map = id_to_fd_map}); -- 2.39.5