[libvirt] [PATCH RFC] LXC: add HOME environment variable

Chen, Hanxiao chenhanxiao at cn.fujitsu.com
Thu Sep 4 09:58:58 UTC 2014



> -----Original Message-----
> On Tue, Aug 12, 2014 at 11:21:41AM +0200, Richard Weinberger wrote:
> > On Mon, Aug 11, 2014 at 11:13 AM, Daniel P. Berrange
> > <berrange at redhat.com> wrote:
> > > On Tue, Aug 05, 2014 at 02:40:53AM +0000, chenhanxiao at cn.fujitsu.com wrote:
> > >> ping
> > >>
> > >> > -----Original Message-----
> > >> > From: libvir-list-bounces at redhat.com
> [mailto:libvir-list-bounces at redhat.com]
> > >> > On Behalf Of Chen Hanxiao
> > >> > Sent: Friday, July 25, 2014 2:40 PM
> > >> > To: libvir-list at redhat.com
> > >> > Subject: [libvirt] [PATCH RFC] LXC: add HOME environment variable
> > >> >
> > >> > We lacked of HOME environment variable,
> > >> > set 'HOME=/' as default.
> > >> >
> > >> > Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > >> > ---
> > >> >  src/lxc/lxc_container.c | 1 +
> > >> >  1 file changed, 1 insertion(+)
> > >> >
> > >> > diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> > >> > index 1cf2c8f..9df9c04 100644
> > >> > --- a/src/lxc/lxc_container.c
> > >> > +++ b/src/lxc/lxc_container.c
> > >> > @@ -236,6 +236,7 @@ static virCommandPtr
> > >> > lxcContainerBuildInitCmd(virDomainDefPtr vmDef,
> > >> >      virCommandAddEnvString(cmd, "PATH=/bin:/sbin");
> > >> >      virCommandAddEnvString(cmd, "TERM=linux");
> > >> >      virCommandAddEnvString(cmd, "container=lxc-libvirt");
> > >> > +    virCommandAddEnvString(cmd, "HOME=/");
> > >> >      virCommandAddEnvPair(cmd, "container_uuid", uuidstr);
> > >> >      if (nttyPaths > 1)
> > >> >          virCommandAddEnvPair(cmd, "container_ttys",
> > >> > virBufferCurrentContent(&buf));
> > >
> > > I'm curious what expects to have a $HOME env var set. I'd tend to view
> > > the setting of $HOME to be something that the software in the container
> > > should take care of.
> >
> > The kernel sets up $HOME for the init process.
> > Therefore any init can assume that $HOME is set.
> > libvirt currently violates that implicit rule.
> 
> Ah ok, that makese sense then. ACK

Could anyone help to push this patch
according to Dan's ACK?

Thanks,
- Chen

> 
> >
> > > Setting HOME=/ in libvirt isn't a problem, I'm just curious why we need
> > > it.
> 
> Regards,
> Daniel
> --
> |: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org              -o-             http://virt-manager.org :|
> |: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list