[lxc-devel] [RFC PATCH] lxc: add clone hook.
Scott Moser
smoser at ubuntu.com
Wed May 15 16:27:38 UTC 2013
On Wed, 15 May 2013, Serge Hallyn wrote:
> > > Soon analogous create and destroy hooks will be added as well.
> >
> > I think I'd have preferred storing the command arguments in
> > LXC_CLONE_ARGS instead of directly in argv. Doing so would allow us to
> > remove/add other arguments without breaking all existing hooks.
> >
> > The user could then do "set -- $LXC_CLONE_ARGS" and just use $1... as usual.
> >
> > But I'm not horribly opposed to the proposed implementation and the rest
> > looks good.
>
> Actually,
>
> yeah that would let menot add the argv[] to run_lxc_hooks, and make the
> patch quite a bit shorter.
>
> I'll redo it like that.
I'd really prefer proper arguments.
In argv you have null terminated strings, a proper array.
In "LXC_CLONE_ARGS" you have to encode the null terminated string in some
way, forcing the comsumer to unencode it.
Ie,
set -- $LXC_CLONE_ARGS
which is actually insufficient.
In order to avoid shell expansion, the user has to do something like this:
eval set -- "${LXC_CLONE_ARGS}"
and you'll have to shell escape the content that you put in there.
More information about the lxc-devel
mailing list