On Thu, Dec 30, 2021 at 10:02:55AM +0100, Andras Korn wrote:

> On Wed, Dec 29, 2021 at 03:07:38AM +0100, Lorenzo wrote:
> 
> > I'm going to accept a fix for this issue, but I prefer to not have to
> > parse a file and also to not add another flag file only for this, if
> > it's possible.
> 
> Well, getting the first character from a file and printing it verbatim is
> hardly "parsing". :)

I gave this more thought.

I hadn't considered that even /etc/runit/3 depends on /run/runit.reboot
being present and having the correct mode.

I checked the source of runit-init and it creates /run/runit.reboot if it
doesn't exist, not just sets its mode.

Thus, purely for the purpose of rebooting via kexec, depending on
/run/runit.reboot existing and having the correct mode at the time
/etc/runit/3 is executed seems adequate (even if technically racy).

I still worry that by changing the behaviour of runlevel(8) so it depends on
/run/runit.reboot will break something for someone somewhere, but I suppose
you can say they broke it for themselves by fiddling with /run/runit.reboot.

I can think of more convoluted ways of keeping track of the runlevel and
reporting it, but I'll spare you. :) (Avoiding race conditions completely is
not possible since no matter what we do, "check runlevel"; "do something
based on runlevel" will never be an atomic operation in the kexec
initscript. While technically correct is the best kind of correct, it's
probably not worth it to aim for perfection in this instance.)

AndrĂ¡s

-- 
        In the context of marriage, a moral victory is something you'll
                  invariably end up celebrating on your own.

Reply via email to