summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-07-29openrc-run: print proper errors when exclusive_fd failsorigin/proper-errorsAnna (navi) Figueiredo Gomes
2025-07-24recognise alacritty as a color terminaldakkar
2025-07-12librc: allow user services to add boot servicesAnna (navi) Figueiredo Gomes
Fixes: https://github.com/OpenRC/openrc/issues/880
2025-07-12openrc-run: remove timeout from start/stopAnna (navi) Figueiredo Gomes
4d8a5c4 added the timeout logic from svc_wait into svc_exec, with the goal of avoiding stalling the boot process should a service hang, however we failed to mention the change in NEWS, and some critical services like postgres rely on inifinite timeout for `stop()`. this logic was also sharing the `timeout` keyword from `depend()`, which is not very clean let's revert the timeout logic, and properly re-introduce it later, with effort put into making sure no issues happen. Bug: https://github.com/OpenRC/openrc/issues/896
2025-07-08librc-depend: clear dirfds unconditionallyAnna (navi) Figueiredo Gomes
init.sh creates the directory, which means we never actually do it here early at boot Fixes: 22bfd3a Fixes: https://github.com/OpenRC/openrc/pull/893
2025-07-05openrc-run: unset signal_pipe[1] before closing itDominique Martinet
In the unlikely case the service timed out and the child process exited just as we closed the file descriptor, the signal handler could try writing to an invalid fd. There is no other thread around so this is harmless but might as well unset the variable first.
2025-07-05openrc-run: block SIGCHLD during fork() to avoid race with reapingDominique Martinet
The signal handler in openrc-run expects service_pid to be set when the child process exists, but there is no guarantee that the execution thread will have been scheduled before the signal handler, leading to service not being detected as started properly very occasionally. This can be tested with the following reproducer: ``` #include <signal.h> #include <stdio.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> static pid_t service_pid; static void handle_signal(int sig) { int status; pid_t pid; switch (sig) { case SIGCHLD: while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { if (pid != service_pid) printf("Got %d != %d\n", pid, service_pid); } break; default: printf("caught unknown signal %d\n", sig); } } int signal_setup(int sig, void (*handler)(int)) { struct sigaction sa; memset(&sa, 0, sizeof (sa)); sigemptyset(&sa.sa_mask); sa.sa_handler = handler; return sigaction(sig, &sa, NULL); } int main(int argc, char **argv) { signal_setup(SIGCHLD, handle_signal); while (1) { #ifdef FIX sigset_t full, old; sigfillset(&full); sigprocmask(SIG_SETMASK, &full, &old); #endif service_pid = fork(); #ifdef FIX sigprocmask(SIG_SETMASK, &old, NULL); #endif if (service_pid < 0) { printf("fork fail %m\n"); return 1; } // exit child immediately if (service_pid == 0) return 0; // wait for child process to stop a different way while (kill(service_pid, 0) >= 0); } return 0; } ``` Fixes #895
2025-06-29librc: clear dirfds when creating new svcdirAnna (navi) Figueiredo Gomes
if for whatever reason, /run/openrc exists in the rootfs before first boot, we'd still end up with an invalid fd. while users are not really supposed to have anything in /run (under the tmpfs mount), should they do, it's better to not fail clearing the dirfds as we create svcdir also means we don't need a new librc api function to clear it, for now at least.
2025-06-28AUTHORS: add naviSam James
navi is one of the co-maintainers of OpenRC, can cut releases by herself since 4ea8adf13aae30101a0d810225faf9389f8b5c6f, and wrote user services support. Do as ska suggests in 2a2e6be1b700c05938833c92d9cc5070b3e34f3f and bless her with AUTHORS.
2025-06-27shared/misc: open svcdir dirfd after update_neededAnna (navi) Figueiredo Gomes
otherwise /run/openrc might not exist, and result on svcdirfd being -1 Fixes: https://github.com/OpenRC/openrc/issues/888
2025-06-19*-daemon: filter EINFO_ and SVCNAME variables as wellAnna (navi) Figueiredo Gomes
2025-06-19*-daemon: actually filter RC_/SSD_ variablesAnna (navi) Figueiredo Gomes
oops, inverted check Fixes: 7208da2
2025-06-18add document describing the release processWilliam Hubbs
2025-06-16helpers: remove existss, unused internal functionAnna (navi) Figueiredo Gomes
2025-06-16checkpath,shared/misc: remove is_writable helperAnna (navi) Figueiredo Gomes
only one consumer, checkpath, and can easily be done directly with the access syscall
2025-06-16librc: fix FILE * leak in rc_proc_getentAnna (navi) Figueiredo Gomes
2025-06-16*: don't check for file existence before opening itAnna (navi) Figueiredo Gomes
{f,}open and setmntent will already fail if the file does not exists, no need for an extra syscall
2025-06-16*: use access(..., F_OK) instead of exists/stat.2Anna (navi) Figueiredo Gomes
the exists() helper uses stat.2 unnecessarily, while calling access is simpler and does not require filling a struct stat for no reason. since this would make exists() into a wrapper that calls a single function and nothing else, let's just inline the calls to access and remove the helper.
2025-06-15librc: don't create /run/openrc itself on demand.Anna (navi) Figueiredo Gomes
this is a temporary fix, in a system that boots with / as rw, /run unmounted, and has rc_parallel on, openrc would create a dirfd to /run/openrc before mounting /run, thus keeping an open fd to the old /run mountpoint, and creating 'exclusive' lockfiles under it, that subsequent services can't see nor lock on. Fixes: https://github.com/OpenRC/openrc/issues/859 Fixes: 07d6f4d5
2025-06-11Fix error message in parse_scheduleYury Vostrikov
Make it consistent with the other one: in case of error report failed input. Also change quoting from `%s' to '%s'.
2025-06-07binfmt: also look in /usr/local/lib/binfmt.dArusekk
This is consistent with systemd, and kind of natural.
2025-06-03shared/misc.c: update mtime on deptree, not the clock-skew fileAnna (navi) Figueiredo Gomes
Fixes: https://github.com/OpenRC/openrc/issues/874
2025-06-03shared/misc.c: print correct file for skewAnna (navi) Figueiredo Gomes
2025-06-02Add missing description for --notify option of supervise-daemonYury Vostrikov
This diff fixes incorrect output of --help due to missing help string. Because longots_help arrays was shorter by one element, running --help produced incorrect result. It could also lead to crash due to OOB access. Before: $ RC_SVCNAME=foo supervise-daemon foo --help | tail -n 9 --stderr-logger <arg> Redirect stderr to process -3, --reexec reexec (used internally) --notify <arg> Display this help output -h, --help Disable color output -C, --nocolor Display software version -V, --version Run verbosely -v, --verbose Run quietly (repeat to suppress errors) -q, --quiet Run in user mode -U, --user healthcheck-timer After: -3, --reexec reexec (used internally) --notify <arg> Open notify pipe -h, --help Display this help output -C, --nocolor Disable color output -V, --version Display software version -v, --verbose Run verbosely -q, --quiet Run quietly (repeat to suppress errors) -U, --user Run in user mode
2025-05-27*-daemon: fix order of chrootNRK
in the current order, we use pam_start and read /etc/group *after* chroot-ing. this is undocumented in the manpages, causes issues (#543) and is also very inconsistent (e.g we get the gid from the root database, not the chroot one. also stuff like expand_home() happens before chroot etc). so make pam_start and getgrouplist happen before chroot(). Ref: https://github.com/OpenRC/openrc/pull/517 Fixes: https://github.com/OpenRC/openrc/issues/543
2025-05-27*-daemon: don't assume [ug]id_t to be `int`NRK
use PRIuMAX and cast to uintmax_t for portability.
2025-05-27build: specify kvm/libcap dependency more clearlyAnna (navi) Figueiredo Gomes
Fixes: https://github.com/OpenRC/openrc/pull/627 Fixes: https://github.com/OpenRC/openrc/issues/626
2025-05-27build: drop 'os' option and use host_machine.system()Anna (navi) Figueiredo Gomes
to specify a different host, meson's machine files should be used instead.
2025-05-27build: drop GNU-kFreeBSD supportAnna (navi) Figueiredo Gomes
Debian GNU-kFreeBSD was the only known distribution, and they dropped support for GNU-kFreeBSD back in 2023[1] 1: https://lists.debian.org/debian-devel/2023/07/msg00176.html
2025-05-27build: cleanup meson.build logicAnna (navi) Figueiredo Gomes
2025-05-27build: add project arguments instead of adhoc c_argsAnna (navi) Figueiredo Gomes
2025-05-27build: use declare_dependency for librcAnna (navi) Figueiredo Gomes
2025-05-27build: use declare_dependency for libeinfoAnna (navi) Figueiredo Gomes
2025-05-27build: use static_library and declare_dependency for shared codeAnna (navi) Figueiredo Gomes
2025-05-26einfo.3: eindent indents by 2 charactersUlrich Müller
2025-05-26libeinfo.c: Fix out-of-bounds array access in _eindentUlrich Müller
fprintf handles padding itself, so get rid of the array altogether.
2025-05-26libeinfo.c, functions.sh: Drop upper limit for EINFO_INDENTUlrich Müller
_eindent() already limits the width, so the additional limit in eindent is not needed. It also prevented proper alignment of corresponding eindent and eoutdent calls when the limit was exceeded.
2025-05-20supervisor=s6: fix indentation, add more paranoid hardeningLaurent Bercot
2025-05-20supervisor=s6 support: additional small bugfixesLaurent Bercot
2025-05-20supervisor=s6: rework supportLaurent Bercot
This commit modernizes the support for the supervisor=s6 backend. It reworks how the supervision tree is started and how the services are defined. The s6-svscan service now runs its own catch-all logger, logging to $RC_SVCDIR/s6-logs. A service defining supervisor=s6 now has an automatic "need" dependency to s6-svscan. A service directory will be automatically built from the information in the service file, under the $RC_SVCDIR/s6-services repository. These service directories are cached until the service file (or config) changes. So, services don't need to provide their service directories themselves anymore; they still can, but they'll need to do the s6-sv[un]link thing themselves. The documentation has been updated. Anna, please add yourself to the AUTHORS file, because it is ridiculous that I am now in it and you are not.
2025-05-05start-stop-daemon: add longopts_help value for --notifyDaniel Watkins
Without this, the help output from `--notify` onwards is incorrectly off-by-one, e.g.: ``` --notify <arg> Display this help output -h, --help Disable color output -C, --nocolor Display software version ``` By aligning its length with that of `longopts`, this also fixes a segfault we've observed in our arm64 builds.
2025-05-05*-daemon: properly log ready fd errorAnna (navi) Figueiredo Gomes
2025-05-02openrc-user: simplify argc checkRahul Sandhu
Signed-off-by: Rahul Sandhu <nvraxn@gmail.com>
2025-04-29service-script-guide: improve markupfkobi
Now it renders nicer.
2025-04-29build: fix installation of getty symlinksWilliam Hubbs
The getty symlinks are installed both in the init.d directory and the default runlevel directory. This makes the getty installation consistent with the rest of the runlevel setup.
2025-04-29Reduce needless indentationHugo Osvaldo Barrera
The parameter passed to -width is a raw string whose length is used to determine the width of the left column. The value being passed includes macros (which are not treated as such in this context). The string is therefore longer than it needs to be, and the leftmost column much wider than it needs to be.
2025-04-29man: use Ic macro for rc-update commandsHugo Osvaldo Barrera
The Ar macro is used for arguments. The Ic macro is used for internal commands. The latter is suitable for subcommands of rc-update. When rendered via man, this makes commands and variable arguments visually distinct (bold and underlined respectively by default).
2025-04-29librc: fix existsat check in rc_service_scheduled_startAnna (navi) Figueiredo Gomes
this flips the logic, causing no service to ever be scheduled to start. Bug: https://bugs.gentoo.org/954761#c6
2025-04-29build: remove the meson_runlevels scriptWilliam Hubbs
2025-04-29build: install runlevels with mesonWilliam Hubbs
This removes the need for the external install script that set up the runlevels.