[systemd-devel] [PATCH v3] systemctl: add edit verb

Lennart Poettering lennart at poettering.net
Wed Oct 22 02:04:44 PDT 2014


On Tue, 21.10.14 23:04, Ronny Chevalier (chevalier.ronny at gmail.com) wrote:

> > I think we should really take some inspiration here from how git
> > prepares the editor when asking for commit messages: adding a really
> > useful commented help text to the end of the new file to edit would be
> > really awesome. More specifically, I think we should include an output
> > equivalent to "systemctl cat"'s add the end, commented and prefixed
> > with some clear marker that we can then use to remove the bits again
> > before saving things.
> Yeah It seems nice.
> 
> Do you prefer that I add this in the correction of this patch, or with
> follow-up patches ?

follow-up is fine.

> > Hmm, when precisely is this actually triggered? I mean, if the file
> > already exists in /etc we should just edit it there...
> There is a specific case when this can happen.
> 
> Imagine you have a unit foobar with
> FragmentPath=/usr/lib/systemd/system/foobar.service, and you added
> manually /etc/systemd/system/foobar.service without doing
> daemon-reload. When avoid_bus() == false, we will get the /usr/***
> path, so we need to be sure that the user don't want to overwrite the
> one in /etc/***.
> 
> We can avoid this by doing daemon-reload before editing, but I'm not
> sure this is wanted.

Hmm, one option would be not to actually use FragmentPath= as source
but to actually look for the file on the client side (in particularly
useful when --root= is used...). But maybe that's actually
unnecessary, as it only makes the race window smaller, but still
leaves it open a bit...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list