[systemd-devel] Bad handling of "/" in instance names?

Lars Kellogg-Stedman lars at oddbit.com
Thu Jan 31 12:37:55 PST 2013


I have a templated service for which each instance needs to receive
arguments of the form "foo/bar".  This works fine when starting the
service:

  # systemctl start myservice at foo/bar.service

But trying to *enable* this service results in an error:

  # systemctl enable myservice at foo/bar
  Failed to issue method call: Invalid argument

I'm assuming this happens because systemd is trying to create a symlink
with a "/" in the name and is falling over.  I can think of a number of
ways of dealing with this:

A. I just write a wrapper script that accepts multiple arguments,
   builds a command line, and runs the service.  I don't like this
   solution because I was trying to avoid wrapping everything in shells
   cripts.

B. Use some form of quoting for filenames to avoid this
   problem.  E.g., in this case, create a link on disk named
   'myservice at foo%2Fbar' (assuming URL-style  quoting).

C. Reject instance names that contain "/" characters.

Thoughts? I'm going with A as an immediate solution, but I'd prefer
something like B in the long run.

-- 
Lars Kellogg-Stedman <lars at oddbit.com>




More information about the systemd-devel mailing list