* [PATCH] xend: enable environment passing in xPopen3
@ 2012-11-21 20:49 Olaf Hering
2012-11-23 10:10 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2012-11-21 20:49 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1353530937 -3600
# Node ID a446956472330fe32bc69be764a33f59fb090792
# Parent 2489c29266982175b5b4e945c97b4549360e947f
xend: enable environment passing in xPopen3
In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
xPopen3, but no code was added to actually pass the environment down to
execvpe. Also, the new code was unreachable.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff -r 2489c2926698 -r a44695647233 tools/python/xen/util/xpopen.py
--- a/tools/python/xen/util/xpopen.py
+++ b/tools/python/xen/util/xpopen.py
@@ -104,7 +104,7 @@ class xPopen3:
os.dup2(c2pwrite, 1)
if capturestderr:
os.dup2(errin, 2)
- self._run_child(cmd)
+ self._run_child(cmd, env)
os.close(p2cread)
self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
os.close(c2pwrite)
@@ -116,7 +116,7 @@ class xPopen3:
self.childerr = None
_active.append(self)
- def _run_child(self, cmd):
+ def _run_child(self, cmd, env):
if isinstance(cmd, basestring):
cmd = ['/bin/sh', '-c', cmd]
for i in range(3, MAXFD):
@@ -127,7 +127,6 @@ class xPopen3:
except OSError:
pass
try:
- os.execvp(cmd[0], cmd)
if env is None:
os.execvp(cmd[0], cmd)
else:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xend: enable environment passing in xPopen3
2012-11-21 20:49 [PATCH] xend: enable environment passing in xPopen3 Olaf Hering
@ 2012-11-23 10:10 ` Ian Campbell
2012-11-23 10:52 ` Olaf Hering
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2012-11-23 10:10 UTC (permalink / raw)
To: Olaf Hering; +Cc: xen-devel@lists.xen.org
On Wed, 2012-11-21 at 20:49 +0000, Olaf Hering wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1353530937 -3600
> # Node ID a446956472330fe32bc69be764a33f59fb090792
> # Parent 2489c29266982175b5b4e945c97b4549360e947f
> xend: enable environment passing in xPopen3
>
> In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
> xPopen3, but no code was added to actually pass the environment down to
> execvpe. Also, the new code was unreachable.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
It seems that no callers provide an environment? How did you spot this?
> diff -r 2489c2926698 -r a44695647233 tools/python/xen/util/xpopen.py
> --- a/tools/python/xen/util/xpopen.py
> +++ b/tools/python/xen/util/xpopen.py
> @@ -104,7 +104,7 @@ class xPopen3:
> os.dup2(c2pwrite, 1)
> if capturestderr:
> os.dup2(errin, 2)
> - self._run_child(cmd)
> + self._run_child(cmd, env)
> os.close(p2cread)
> self.tochild = os.fdopen(p2cwrite, 'w', bufsize)
> os.close(c2pwrite)
> @@ -116,7 +116,7 @@ class xPopen3:
> self.childerr = None
> _active.append(self)
>
> - def _run_child(self, cmd):
> + def _run_child(self, cmd, env):
> if isinstance(cmd, basestring):
> cmd = ['/bin/sh', '-c', cmd]
> for i in range(3, MAXFD):
> @@ -127,7 +127,6 @@ class xPopen3:
> except OSError:
> pass
> try:
> - os.execvp(cmd[0], cmd)
> if env is None:
> os.execvp(cmd[0], cmd)
> else:
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xend: enable environment passing in xPopen3
2012-11-23 10:10 ` Ian Campbell
@ 2012-11-23 10:52 ` Olaf Hering
2012-11-23 11:09 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2012-11-23 10:52 UTC (permalink / raw)
To: Ian Campbell; +Cc: xen-devel@lists.xen.org
On Fri, Nov 23, Ian Campbell wrote:
> On Wed, 2012-11-21 at 20:49 +0000, Olaf Hering wrote:
> > # HG changeset patch
> > # User Olaf Hering <olaf@aepfle.de>
> > # Date 1353530937 -3600
> > # Node ID a446956472330fe32bc69be764a33f59fb090792
> > # Parent 2489c29266982175b5b4e945c97b4549360e947f
> > xend: enable environment passing in xPopen3
> >
> > In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
> > xPopen3, but no code was added to actually pass the environment down to
> > execvpe. Also, the new code was unreachable.
> >
> > Signed-off-by: Olaf Hering <olaf@aepfle.de>
>
> It seems that no callers provide an environment? How did you spot this?
In my testing I did pass options to xc_save via the environment, which
is called via forkhelper (somewhere in python code).
Olaf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xend: enable environment passing in xPopen3
2012-11-23 10:52 ` Olaf Hering
@ 2012-11-23 11:09 ` Ian Campbell
0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2012-11-23 11:09 UTC (permalink / raw)
To: Olaf Hering; +Cc: xen-devel@lists.xen.org
On Fri, 2012-11-23 at 10:52 +0000, Olaf Hering wrote:
> On Fri, Nov 23, Ian Campbell wrote:
>
> > On Wed, 2012-11-21 at 20:49 +0000, Olaf Hering wrote:
> > > # HG changeset patch
> > > # User Olaf Hering <olaf@aepfle.de>
> > > # Date 1353530937 -3600
> > > # Node ID a446956472330fe32bc69be764a33f59fb090792
> > > # Parent 2489c29266982175b5b4e945c97b4549360e947f
> > > xend: enable environment passing in xPopen3
> > >
> > > In changeset 19990:38dd208e1d95 a new parameter 'env' was added to
> > > xPopen3, but no code was added to actually pass the environment down to
> > > execvpe. Also, the new code was unreachable.
> > >
> > > Signed-off-by: Olaf Hering <olaf@aepfle.de>
> >
> > It seems that no callers provide an environment? How did you spot this?
>
> In my testing I did pass options to xc_save via the environment, which
> is called via forkhelper (somewhere in python code).
Thanks. Acked + applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-23 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21 20:49 [PATCH] xend: enable environment passing in xPopen3 Olaf Hering
2012-11-23 10:10 ` Ian Campbell
2012-11-23 10:52 ` Olaf Hering
2012-11-23 11:09 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).