| Age | Commit message (Collapse) | Author |
|
|
|
|
|
Fixes: https://github.com/OpenRC/openrc/issues/880
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
otherwise /run/openrc might not exist, and result on svcdirfd being -1
Fixes: https://github.com/OpenRC/openrc/issues/888
|
|
|
|
oops, inverted check
Fixes: 7208da2
|
|
|
|
|
|
only one consumer, checkpath, and can easily be done directly with the
access syscall
|
|
|
|
{f,}open and setmntent will already fail if the file does not exists, no
need for an extra syscall
|
|
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.
|
|
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
|
|
Make it consistent with the other one: in case of error report failed
input.
Also change quoting from `%s' to '%s'.
|
|
This is consistent with systemd, and kind of natural.
|
|
Fixes: https://github.com/OpenRC/openrc/issues/874
|
|
|
|
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
|
|
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
|
|
use PRIuMAX and cast to uintmax_t for portability.
|
|
Fixes: https://github.com/OpenRC/openrc/pull/627
Fixes: https://github.com/OpenRC/openrc/issues/626
|
|
to specify a different host, meson's machine files should be used
instead.
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fprintf handles padding itself, so get rid of the array altogether.
|
|
_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.
|
|
|
|
|
|
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.
|
|
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.
|
|
|
|
Signed-off-by: Rahul Sandhu <nvraxn@gmail.com>
|
|
Now it renders nicer.
|
|
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.
|
|
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.
|
|
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).
|
|
this flips the logic, causing no service to ever be scheduled to start.
Bug: https://bugs.gentoo.org/954761#c6
|
|
|
|
This removes the need for the external install script that set up the
runlevels.
|