Hey Serge,

Updating some production servers to newer IRC I noticed a slight
breakage with the clearenv() change introduced a month or so ago.

We typically want clearenv() to happen just before the final exec so
that we still have the existing environment for anything before that,
most importantly the hooks.

This appears to be the case for the command line tools but not for the
API. With the API, it looks like the clearenv() is done before the hooks
run.

Here's the environment as I get it from a mount hook when using lxc-start:
SUDO_GID=200512
MAIL=/var/mail/root
LANGUAGE=en_US:en
USER=root
HOME=/home/stgraber
COLORTERM=gnome-terminal
SUDO_UID=201105
LOGNAME=root
TERM=xterm
USERNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LXC_ROOTFS_MOUNT=/usr/lib/x86_64-linux-gnu/lxc
DISPLAY=:0
LXC_CONFIG_FILE=/var/lib/lxc/precise-gui/config
LANG=en_US.UTF-8
XAUTHORITY=/home/stgraber/.Xauthority
SUDO_COMMAND=/usr/bin/lxc-start -n precise-gui
KRB5CCNAME=FILE:/tmp/krb5cc_201105_Lrlyri
SHELL=/bin/bash
SUDO_USER=stgraber
PWD=/home/stgraber/data/vm/lxc/lib
LXC_ROOTFS_PATH=/var/lib/lxc/precise-gui/rootfs
LXC_NAME=precise-gui

And same container but started from the API:
container=lxc
LXC_ROOTFS_MOUNT=/usr/lib/x86_64-linux-gnu/lxc
LXC_CONFIG_FILE=/var/lib/lxc/precise-gui/config
PWD=/
LXC_ROOTFS_PATH=/var/lib/lxc/precise-gui/rootfs
LXC_NAME=precise-gui


The biggest problem here is the absence of PATH, making my hooks fail.
For now I simply hardcoded PATH, but I think we'll want to make the
environment from the API match that of lxc-start and find a way of
moving clearenv a bit closer to the final exec there too.

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to