Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 527614 - systemd service file fix for net-misc/openvpn
Summary: systemd service file fix for net-misc/openvpn
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Dirkjan Ochtman (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-31 13:34 UTC by Fpemud
Modified: 2014-12-02 21:22 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fpemud 2014-10-31 13:34:00 UTC
"%i" should be replaced by "%I" in /usr/portage/net-misc/openvpn/files/openvpn.service

My open server config filename is "/etc/openvpn/server_tcp(Fpemud).conf". 
systemd names the service file as "/etc/systemd/system/multi-user.target.wants/openvpn@server_udp\x28Fpemud\x29.service", so openvpn can't find the correct config file.



Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2014-10-31 14:33:44 UTC
From systemd.unit(5):

       │"%I"      │ Unescaped instance name  │ Same as "%i", but with   │
       │          │                          │ escaping undone          │

So that seems appropriate here.
Comment 2 Fpemud 2014-11-05 03:55:21 UTC
Poke. This is an easy one.

I have made an ebuild to fix it myself, it works well.
https://github.com/fpemud/fpemud-workstation-local-overlay/tree/master/pkg-local/local-openvpn-fix

I think there would be other service files that have the same problem, do you think there's any way for us to fix them together? Or we should file seperate bug report for each package when it occurs on our system.
Comment 3 Mike Gilbert gentoo-dev 2014-11-05 04:01:11 UTC
Fixed without revbump; the number of affected users here is probably quite small.

+  05 Nov 2014; Mike Gilbert <floppym@gentoo.org> files/openvpn.service:
+  Use unescaped instance name for PIDFile and config file, bug 527614.
Comment 4 Arnaud Launay 2014-12-02 08:34:36 UTC
Hello,

This change breaks my config files, I use a company-type.conf openvpn file, and with %I systemd looks for "company/type.conf" file, obviously wrong.

Please undo.
Comment 5 Fpemud 2014-12-02 17:29:23 UTC
In your case, you should do "systemctl enable openvpn@company\\x2dtype", so it would be unescaped to "company-type".

Example:
fpemud-workstation / # systemd-escape --unescape company\\x2dtype
company-type

It is the standard systemd name pattern, you can check "\x2d" in "man systemd.unit" for more detail.
Comment 6 Mike Gilbert gentoo-dev 2014-12-02 17:37:24 UTC
Right... we can either revert the change and not support certain characters in the config file name, or we can force people to escape their instance names as suggested in comment 5.

Either way, somebody is inconvenienced. Using the escape mechanism is ultimately more flexible, so I would prefer to leave that in place.
Comment 7 Arnaud Launay 2014-12-02 17:44:01 UTC
Oh, come on. You prefer to support windows-like parentheses rather than classic unix dash ?

Either way, systemd is just doing it plain wrong. On what right does it mess with the arguments given to an unit ?

It should respect and work as shell expansion anyway:

$ ls stuff-with-dash.txt stuff\(with\)\(lisp\).txt 

Parentheses are escaped. dashes aren't. Ergo, parentheses are the ones needed to be escaped.

Oh, and it gets even better, as you have to pass your argument to the shell, not only do you have to escape the dash, but also the \ , as you wrote.

company\\x2dtype

Do you REALLY think people will work this out ???
Comment 8 Mike Gilbert gentoo-dev 2014-12-02 18:58:19 UTC
At some point we should switch to using the unit files from upstream. These do not use %I for the instance name.

https://github.com/OpenVPN/openvpn/tree/master/distro/systemd
Comment 9 Craig Andrews gentoo-dev 2014-12-02 19:48:32 UTC
(In reply to Mike Gilbert from comment #8)
> At some point we should switch to using the unit files from upstream. These
> do not use %I for the instance name.
> 
> https://github.com/OpenVPN/openvpn/tree/master/distro/systemd

I reported this issue as bug 531474
Comment 10 Arnaud Launay 2014-12-02 20:17:33 UTC
I note upstream use %i and not %I. Anyhow, on a global scale, I don't think the systemd escaping way is a good one. They replace dash with / , which seems pretty stupid/crazy/dump to me.
Comment 11 Matthias Maier gentoo-dev 2014-12-02 20:45:14 UTC
In this case it might be more appropriate to go with upstream's %i - which is also used by other distributions, e.g. Debian and OpenSuSE. (And ultimately migrate to upstream's service files).
Comment 12 Mike Gilbert gentoo-dev 2014-12-02 21:22:35 UTC
(In reply to Matthias Maier from comment #11)
> In this case it might be more appropriate to go with upstream's %i - which
> is also used by other distributions, e.g. Debian and OpenSuSE. (And
> ultimately migrate to upstream's service files).

Agreed. I will revert.