openrc: don’t exec plugin hook in atexit
Just like openrc-run, the cleanup function in rc.c checks if there are remaining hooks to run (by checking hook_out) and runs plugins. Calling exit() more than once like OpenRC does is undefined behavior. For more details, see the previous commit message.
In practise this means, if a plugin (such as plymouth-openrc-plugin) is installed in a musl-based system, 2 scenarios may occur:
- A service fails on boot: OpenRC is sort of stuck. If a GUI is running already, it may not look like much has happened, but things like shutting down won’t work (would need to use
reboot -fwithout going through openrc)- A service fails on shutdown: shutdown just hangs, have to forcibly poweroff.
Remove all the handling of plugin hooks on exit, and instead explicitely run the hooks on most failures, but before exit().
Signed-off-by: Ferass El Hafidi funderscore@postmarketos.org
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
OpenRC README
OpenRC is a dependency-based init system that works with the system-provided init program, normally
/sbin/init.building and installing
OpenRC uses the meson build system, so use the usual methods for this build system to build and install.
Notes
We don’t support building a static OpenRC with PAM.
PKG_PREFIXshould be set to where packages install to by default.LOCAL_PREFIXshould be set to where user maintained packages are. Only setLOCAL_PREFIXif different fromPKG_PREFIX.rcandrc.shutdownare the hooks from the BSD init into OpenRC.devd.confis modified from FreeBSD to call/etc/rc.devdwhich is a generic hook into OpenRC.inittabis the same, but for SysVInit as used by most Linux distributions. This can be found in the support folder.Obviously, if you’re installing this onto a system that does not use OpenRC by default then you may wish to backup the above listed files, remove them and then install so that the OS hooks into OpenRC.
If you are installing this onto a system which has separate / and /usr file systems and expects / to be mounted before /usr, you will need to make sure the appropriate pieces are installed on / by passing the appropriate options to “meson setup” as follows:
Discussions
We are testing discussions, so feel free to open topics there.
Reporting Bugs
Please report bugs on our bug tracker.
If you can contribute code , please feel free to do so by opening pull requests.
IRC Channel
We have an official irc channel, #openrc on the libera network. Please connect your irc client to irc.libera.chat and join #openrc on that network.