[lxc-devel] [RFC PATCH] lxc: add clone hook.

Serge Hallyn serge.hallyn at ubuntu.com
Wed May 15 18:19:49 UTC 2013


Quoting Scott Moser (smoser at ubuntu.com):
> 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.

Ok, then let's wait a day to think about it, and perhaps go with the
original patch.  Because I can't think of a good way to work around
that.  (We can't set IFS to '\0' can we...)

Thanks everyone.




More information about the lxc-devel mailing list