WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH] add back in a default $PATH to subprocesses

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH] add back in a default $PATH to subprocesses
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 21 Dec 2009 14:04:14 +0000
Delivery-date: Mon, 21 Dec 2009 05:58:45 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1261404220 0
# Node ID d28edd3c8bd96f4f280d2e9080c0a7dfb830f889
# Parent  3dfa078d2b22ec7f821ac2388c420d10f00d546f
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 <dave.scott@xxxxxxxxxxxxx>

diff -r 3dfa078d2b22 -r d28edd3c8bd9 stdext/forkhelpers.ml
--- a/stdext/forkhelpers.ml     Sat Dec 19 16:37:00 2009 +0000
+++ b/stdext/forkhelpers.ml     Mon Dec 21 14:03:40 2009 +0000
@@ -20,6 +20,8 @@
    (since that would cause deadlock) *)
 
 (* XXX: this is a work in progress *)
+
+let default_path = [ "/sbin"; "/usr/sbin"; "/bin"; "/usr/bin" ]
 
 open Pervasiveext
 
@@ -201,7 +203,7 @@
 
     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});
 
1 file changed, 3 insertions(+), 1 deletion(-)
stdext/forkhelpers.ml |    4 +++-


Attachment: xen-api-libs.hg.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] add back in a default $PATH to subprocesses, David Scott <=