Bug#772555: untested hacky attempt at using systemctl preset

Raphael Hertzog hertzog at debian.org
Fri Mar 4 15:30:53 GMT 2016


Hi,

On Fri, 04 Mar 2016, Andreas Henriksson wrote:
> > So I have read about what smartmatch does... but basically I think it
> > does not do what you wanted to do. So can you tell me what you wanted
> > to test?
> 
> The end result is only used for "changed something" (or not).
> 
> See: $changed_sth = ...

Yes, but it also impacts the "return unless $changed_sth" and thus
whether we will run the fallback code or not. I think we should always
run the fallback code...

> I left the inital attempt commented out which might help clarify this a
> bit. See the commented "is_enabled" calls and comparison.
> I realised that simple comparison is not correct since the unit you're
> operating on could possibly be unchanged status while something else
> changed (eg. an underlying unit which got pulled in via Also=).

Yes, but you need to compare the list of existing symlinks in that case.
And get_link_closure() doesn't tell you this information.

> Example: unit foo.service contains Also=bar.service, foo.service is already
> enabled (because previous versions did not have the Also=bar.service?)
> while bar.service is not. Running "systemctl preset foo.service" (via
> updating the foo-package containing foo.service) will lead
> to bar.service becoming enabled while foo.service status is unchanged.

So this shows an other actual problem... we should probably not rerun "systemctl
preset" on package upgrade, do we? Otherwise we will overwrite any change
made by the local administrator...

Currently the code creating the symlinks are protected by a check on the
state file and the call to "systemctl preset" should be similarly
protected.

> $changed_sth = 1;
> 
> This seems to just lead to a "systemctl daemon-reload" which shouldn't
> be the end of the world if it runs even when not needed.
> 
> Making a really convoluted solution just for correctness seems like
> a bad idea...

Ack.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Support Debian LTS: http://www.freexian.com/services/debian-lts.html
Learn to master Debian: http://debian-handbook.info/get/




More information about the Pkg-systemd-maintainers mailing list