aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-24openrc-run: remove kludge in restart --no-depsDominique Martinet
restarting a service with --no-deps ran into a "hairy workaround", which had a few problems discussed in [1]: - it ignores --dry-run, really restarting the requested service - if the service was stopped, the program is started but the service status stays stopped. This makes long-lived services impossible to (re)start again (pid already exists and running), and the service also won't stop on shutdown. The kludge had a long comment describing the following situation: - openvpn needs net and dns - net restarts dns - dns needs net If the restart in net handled deps, openrc would deadlock waiting for net in dns' restart, as net won't be started until that is done. Restarting with --nodeps works around the deadlock, but can display errors without the kludge (note that the services did start properly anyway, the problem is that the default service path tries to lock dns twice from openvn's dep's start and net's start's restart): --- alpine:~# rc-service openvn start openvn | * Caching service dependencies ... [ ok ] net |net starting net |dns | * Call to flock failed: Resource temporarily unavailable net |dns | * ERROR: dns stopped by something else net |net started dns |dns started openvn |openvn started alpine:~# rc-status | grep s[1-3] net [ started ] dns [ started ] openvn [ started ] --- Locking again in restart --nodep can fail in two patterns: - openvpn's need dependency start was first, and the restart in net failed (case above): we can just silence locking failures and exit quietly with restart --no-deps, which is not worse than trying to restart while another process hold the lock. - the restart in net's start was first, and openvpn's need dependency start failed: not much can be done here short of adding a new status that a no-deps restart is in progress as in the comment, but this case can actually just be solved by adjusting dependencies -- and it actually has already been fixed: the current openvpn init script in alpine only 'use dns', so it will not try to start it, and that will start just fine with openvpn -> net -> dns only each starting each other once sequentially. Another failure pattern is just starting dns directly: that will start net, which will try to restart dns while we are starting it. Silencing messages on restart also solves this. Link: https://github.com/OpenRC/openrc/issues/224 [1]
2023-04-24rc: use LIST_FOREACH_SAFE in cleanup()NRK
according to the linux manpage, the "safe" variant may not be available on all platform. however we bundle our own `queue.h` so this should not be an issue.
2023-04-24rc: block SIGCHLD during pid list operationsNRK
the pid list will be accessed inside the SIGCHLD signal handler. so we must ensure SIGCHLD handler doesn't get invoked while the list is at an inconsistent state making it unsafe to interact with. Co-authored-by: Dominique MARTINET <dominique.martinet@atmark-techno.com> Bug: https://github.com/OpenRC/openrc/issues/589#issuecomment-1406588576
2023-04-24rc: avoid calling free inside SIGCHLD handlerNRK
`free` is not async-signal-safe and calling it inside a signal handler can have bad effects, as reported in the musl ML: https://www.openwall.com/lists/musl/2023/01/23/1 the solution: - keep track of weather remove_pid() is being called from inside a signal handler or not. - if it's inside a signal handler then DO NOT call free - instead put that pointer into a "to be freed later" list. - if it's not inside a signal handler then take the "to be freed later" list and free anything in it. Bug: https://github.com/OpenRC/openrc/issues/589 Reported-by: Dominique MARTINET <dominique.martinet@atmark-techno.com>
2023-04-24fstabinfo: deal with EINTR in waitpid callNRK
2023-04-24fstabinfo: replace vfork with posix_spawnpNRK
problem: * vfork has been removed from POSIX [0]. * clang-tidy flags the `strerror` and `eerror` call inside the vfork-ed child as undefined behavior. solution: use posix_spawnp, which is serves similar purpose and is specified in posix. and as an added bonus, it's also easier to use and less lines of code. [0]: https://www.man7.org/linux/man-pages/man2/vfork.2.html#CONFORMING_TO
2023-04-23einfo.h: fix EINFO_RESTRICT macro usageOskari Pirhonen
Make function declarations use the EINFO_RESTRICT macro instead of __EINFO_RESTRICT which gets treated as the name of the argument.
2023-04-20shared: fix pointer type in UNCONSTSam James
Thanks to vapier for noticing.
2023-04-19meson.build: add -Werror=... for modern C issuesSam James
Clang 16 makes these warnings fatal and GCC 14 is likely to as well.
2023-04-19Rename attribute macros to namespaced RC_*Sam James
This conflicts with linux-headers which uses __unused for some padding members on ppc64le at least. Closes: https://github.com/OpenRC/openrc/issues/622
2023-04-18version 0.47William Hubbs
2023-04-18update newsWilliam Hubbs
2023-04-17rc.conf: note SSD_* vars need exportingDoug Freed
2023-03-07init.d/rc.conf: make unicode default to yesWilliam Hubbs
2023-03-06rc.conf: default to unicode consolepsykose
it's the high year of 2023, after all. closes #607
2023-02-16seedrng: fix copyright yearNRK
this was mistakenly changed to 2023 instead of 2022-2023 in 63a5ee3d
2023-02-15rc-status: comment consistecyanon
2023-02-15rc-status: all flags respect '-f'anon
2023-02-05seedrng: fix memory leak reported by clang-tidyNRK
`seed_dir` gets allocated via xstrdup but never gets freed - which clang-tidy flags as a memory leak. instead of free-ing the allocation, just don't allocate to begin with since there's no need for it. also bump the copyright year.
2023-02-02bash-completions/rc-service: don't use grepNRK
Co-authored-by: Mike Frysinger <vapier@gentoo.org> Closes: https://github.com/OpenRC/openrc/issues/344
2023-01-30start-stop-daemon: avoid malloc inside sig-handlerNRK
same rational as 459783bb Bug: https://github.com/OpenRC/openrc/issues/589
2023-01-30openrc-run: avoid malloc inside sig-handlerNRK
same rational as 459783bb Bug: https://github.com/OpenRC/openrc/issues/589
2023-01-29value: missing includes from IWYUSam James
2023-01-29swclock: missing includes from IWYUSam James
2023-01-29supervise-daemon: missing includes from IWYUSam James
2023-01-29start-stop-daemon: missing includes from IWYUSam James
2023-01-29shell_var: missing includes from IWYUSam James
2023-01-29shared: missing includes from IWYUSam James
2023-01-29service: missing includes from IWYUSam James
2023-01-29seedrng: missing includes from IWYUSam James
2023-01-29rc-update: missing includes from IWYUSam James
2023-01-29rc-status: missing includes from IWYUSam James
2023-01-29rc-service: missing includes from IWYUSam James
2023-01-29rc-depend: missing includes from IWYUSam James
2023-01-29rc-abort: missing includes from IWYUSam James
2023-01-29openrc-shutdown: missing includes from IWYUSam James
2023-01-29openrc-run: missing includes from IWYUSam James
2023-01-29openrc: missing includes from IWYUSam James
2023-01-29openrc-init: missing includes from IWYUSam James
2023-01-29mountinfo: missing includes from IWYUSam James
2023-01-29mark_service: missing includes from IWYUSam James
2023-01-29librc: missing includes from IWYUSam James
2023-01-29libeinfo: missing includes from IWYUSam James
2023-01-29kill_all: missing includes from IWYUSam James
2023-01-29is_older_than: missing includes from IWYUSam James
2023-01-29is_newer_than: missing includes from IWYUSam James
2023-01-29fstabinfo: missing includes from IWYUSam James
2023-01-29einfo: missing includes from IWYUSam James
2023-01-29checkpath: missing includes from IWYUSam James
2023-01-28src: shared: schedules: add missing includes to headerSam James
Needed for clang-tidy prep work, as it requires headers to work standalone (which is useful anyway).