On Fri, 15.05.15 11:36, Richard Maw (richard....@codethink.co.uk) wrote:

> On Fri, May 15, 2015 at 12:10:58PM +0200, Lennart Poettering wrote:
> > On Fri, 15.05.15 13:03, Ivan Shapovalov (intelfx...@gmail.com) wrote:
> > > Hm. Actually, usage of *any* token as a command line separator makes it
> > > impossible to include that token *in* the command line. My original
> > > idea is even worse as it disallows ever giving "--aux-unit" switch to
> > > the client program. So I guess I retract that idea...
> > > What about the second one?
> > 
> > Well, I think this isn't too bad, we could devise a simple escaping
> > scheme to cover this. For example, if we use "--" as separator, then
> > we could tell people to escape this as "\--" (which on the shell would
> > become "\\--") if they actually want it included in the command
> > line...
> > 
> > I much prefer a syntax like this over reading things from arbitrary
> > files I must say...
> 
> Is there precedent in any other commonly used command that could be used
> instead? I've never seen anything that required escaping like this before, and
> I'd prefer something that had common behaviour with something that is already
> used.

Yes, find uses ; as separator, which you have to escape as \;.

> Some options I've thought of are:
> 
> 1.  Accept the command to run as a single string, `sh -c` style and parse it.
>     Parsing it like an ExecStart= line would be nice for consistency.
> 
>     systemd-run --name=foo.service '/bin/foo arg -- arg2' -- \
>                 --name=bar.service -p Nice=80 /bin/bar -- \
>                 -p Nice=20 --name=bazz.service '/usr/bin/bazz arg1 -- arg2'
> 
> 2.  Require the argv of the command to be run to have each argument prefixed 
> by
>     an option, such as --arg, like how you pass -Wl,option to the linker on 
> gcc's
>     command-line.
> 
>     systemd-run --name=foo.service \
>                   --arg /bin/foo --arg arg --arg -- --arg arg2 -- \
>                 --name=bar.service -p Nice=80 \
>                   --arg /bin/bar -- \
>                 -p Nice=20 --name=bazz.service
>                   --arg /usr/bin/bazz --arg arg1 --arg -- --arg arg2

Your options #1 and #2 are not really an option, because what we are
looking for shall be an extension of the current syntax, and for the
current syntax we will concatenate individual params and do not have
them prefixed with any switch.

> 
> 3.  Require that if users need to embed the separator in their command, that
>     they use `sh -c`.
> 
>     systemd-run --name=foo.service /bin/sh -c '/bin/foo arg -- arg2' -- \
>                 --name=bar.service -p Nice=80 /bin/bar -- \
>                 -p Nice=20 --name=bazz.service
>                 /bin/sh -c '/usr/bin/bazz arg1 -- arg2'

Well, that's always the last resort option... But of course, I think
I'd prefer if we didn't require something like this.

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to