mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b7478ff43 | ||
|
|
6c4c16cbdb | ||
|
|
e539dbfe37 | ||
|
|
90c6bcd365 | ||
|
|
c9c268f218 | ||
|
|
3feff37ba5 | ||
|
|
c67d15e272 | ||
|
|
8984c655f8 | ||
|
|
1a7b26bac3 | ||
|
|
1f47718012 | ||
|
|
fa13cddc28 | ||
|
|
185a72bd14 | ||
|
|
cd32c623cf | ||
|
|
ac4b9c2f93 |
@@ -3,6 +3,19 @@ Change Log
|
||||
|
||||
All relevant changes are documented in this file.
|
||||
|
||||
|
||||
[4.12][] - 2025-04-28
|
||||
---------------------
|
||||
|
||||
### Changes
|
||||
- Improve notify:s6 readiness compatibility, by Aaron Andersen
|
||||
- Update `runparts` usage text
|
||||
|
||||
### Fixes
|
||||
- Fix variable overloading in urandom plugin
|
||||
- Fix buffer overwrite in urandom plugin, reported by Aaron Andersen
|
||||
|
||||
|
||||
[4.11][] - 2025-03-27
|
||||
---------------------
|
||||
|
||||
@@ -20,6 +33,11 @@ All relevant changes are documented in this file.
|
||||
the default `SIGTERM`
|
||||
- Fix pre/post/ready/cleanup script execution if service has an
|
||||
optional `env:file` (leading `-`)
|
||||
- Fix blocked signals for pre/post/ready/cleanup scripts preventing
|
||||
normal shutdown when a service/sysv is stopped in its setup state
|
||||
- Fix issue where a pre:script creates a PID file in `/run` cause the
|
||||
service to move from setup state to running. Any `svc_t` in setup,
|
||||
teardown, or cleanup state should be ignored in the pidfile plugin
|
||||
|
||||
|
||||
[4.10][] - 2025-03-03
|
||||
@@ -1780,6 +1798,7 @@ Major bug fix release.
|
||||
* Initial release
|
||||
|
||||
[UNRELEASED]: https://github.com/troglobit/finit/compare/4.11...HEAD
|
||||
[4.12]: https://github.com/troglobit/finit/compare/4.11...4.12
|
||||
[4.11]: https://github.com/troglobit/finit/compare/4.10...4.11
|
||||
[4.10]: https://github.com/troglobit/finit/compare/4.9...4.10
|
||||
[4.9]: https://github.com/troglobit/finit/compare/4.8...4.9
|
||||
|
||||
@@ -251,7 +251,7 @@ All services in runlevel S) are started first, followed by the desired
|
||||
run-time runlevel. Run tasks in runlevel S can be started in sequence
|
||||
by using `run [S] cmd`. Changing runlevels at runtime is done like any
|
||||
other init, e.g. <kbd>init 4</kbd>, but also using the more advanced
|
||||
`intictl` tool.
|
||||
[`initctl`](#commands--status) tool.
|
||||
|
||||
|
||||
**Conditions**
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
AC_INIT([Finit], [4.11-rc2], [https://github.com/troglobit/finit/issues],
|
||||
AC_INIT([Finit], [4.12], [https://github.com/troglobit/finit/issues],
|
||||
[finit], [https://troglobit.com/projects/finit/])
|
||||
AC_CONFIG_AUX_DIR(aux)
|
||||
AM_INIT_AUTOMAKE([1.11 foreign dist-xz subdir-objects])
|
||||
|
||||
@@ -80,6 +80,23 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (svc->state) {
|
||||
case SVC_TEARDOWN_STATE:
|
||||
case SVC_CLEANUP_STATE:
|
||||
case SVC_SETUP_STATE:
|
||||
/*
|
||||
* E.g., a setup script for a container may run in lieu
|
||||
* of crun, trying to fetch a container image from the
|
||||
* network. This script may want to advertise its PID
|
||||
* to the system for clean and swift reboots.
|
||||
*/
|
||||
dbg("%s[%d]: ignoring any PID file changes in CLEANUP/TEARDOWN/SETUP",
|
||||
svc_ident(svc, NULL, 0), svc->pid);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Service condistion to set/clear */
|
||||
mkcond(svc, cond, sizeof(cond));
|
||||
|
||||
|
||||
+8
-5
@@ -78,6 +78,7 @@ static void setup(void *arg)
|
||||
{
|
||||
#ifdef RANDOMSEED
|
||||
struct rand_pool_info *rpi;
|
||||
unsigned char *rpi_buf;
|
||||
ssize_t len = 0;
|
||||
struct stat st;
|
||||
int rc = -1;
|
||||
@@ -103,13 +104,14 @@ static void setup(void *arg)
|
||||
hw = fopen(hwrng, "r");
|
||||
if (hw) {
|
||||
char buf[512];
|
||||
size_t len;
|
||||
size_t num;
|
||||
|
||||
len = fread(buf, sizeof(buf[0]), sizeof(buf), hw);
|
||||
if (len == 0)
|
||||
num = fread(buf, sizeof(buf[0]), sizeof(buf), hw);
|
||||
if (num == 0)
|
||||
fallback(fp);
|
||||
else
|
||||
len = fwrite(buf, sizeof(buf[0]), len, fp);
|
||||
fwrite(buf, sizeof(buf[0]), num, fp);
|
||||
|
||||
fclose(hw);
|
||||
} else {
|
||||
fallback(fp);
|
||||
@@ -137,10 +139,11 @@ static void setup(void *arg)
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
rpi_buf = (unsigned char *)rpi->buf;
|
||||
do {
|
||||
ssize_t num;
|
||||
|
||||
num = read(fd, &rpi->buf[len], RANDOM_BYTES - len);
|
||||
num = read(fd, &rpi_buf[len], RANDOM_BYTES - len);
|
||||
if (num <= 0) {
|
||||
if (num == -1 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
+7
-7
@@ -96,16 +96,16 @@ enum cond_state cond_get(const char *name)
|
||||
|
||||
enum cond_state cond_get_agg(const char *names)
|
||||
{
|
||||
static char conds[MAX_COND_LEN];
|
||||
enum cond_state s = COND_ON;
|
||||
char *cond;
|
||||
|
||||
if (!names)
|
||||
return COND_ON;
|
||||
if (names) {
|
||||
char conds[strlen(names) + 1];
|
||||
const char *cond;
|
||||
|
||||
strlcpy(conds, names, sizeof(conds));
|
||||
for (cond = strtok(conds, ","); s && cond; cond = strtok(NULL, ","))
|
||||
s = min(s, cond_get(cond));
|
||||
strlcpy(conds, names, sizeof(conds));
|
||||
for (cond = strtok(conds, ","); s && cond; cond = strtok(NULL, ","))
|
||||
s = min(s, cond_get(cond));
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ int run_parts(char *dir, char *cmd, const char *env[], int progress, int sysv)
|
||||
#ifndef __FINIT__
|
||||
static int usage(int rc)
|
||||
{
|
||||
warnx("usage: runparts [-dhps?] DIRECTORY");
|
||||
warnx("usage: runparts [-bdhps?] DIRECTORY");
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -2155,6 +2155,8 @@ static void service_pre_script(svc_t *svc)
|
||||
strlcpy(buf, svc->pre_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "pre");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
@@ -2192,6 +2194,7 @@ static void service_post_script(svc_t *svc)
|
||||
else
|
||||
strlcpy(buf, svc->post_script, sizeof(buf));
|
||||
set_pre_post_envs(svc, "post");
|
||||
sig_unblock();
|
||||
|
||||
if (WIFEXITED(svc->status)) {
|
||||
char val[4];
|
||||
@@ -2253,6 +2256,8 @@ void service_ready_script(svc_t *svc)
|
||||
strlcpy(buf, svc->ready_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "ready");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
@@ -2289,6 +2294,8 @@ static void service_cleanup_script(svc_t *svc)
|
||||
strlcpy(buf, svc->cleanup_script, sizeof(buf));
|
||||
|
||||
set_pre_post_envs(svc, "cleanup");
|
||||
sig_unblock();
|
||||
|
||||
execvp(_PATH_BSHELL, argv);
|
||||
_exit(EX_OSERR);
|
||||
}
|
||||
@@ -2905,7 +2912,7 @@ void service_notify_cb(uev_t *w, void *arg, int events)
|
||||
}
|
||||
|
||||
len = read(w->fd, buf, sizeof(buf) - 1);
|
||||
if (len == -1) {
|
||||
if (len <= 0) {
|
||||
warn("Failed reading notification from %s", svc_ident(svc, NULL, 0));
|
||||
return;
|
||||
}
|
||||
@@ -2913,7 +2920,7 @@ void service_notify_cb(uev_t *w, void *arg, int events)
|
||||
buf[len] = 0;
|
||||
|
||||
/* systemd and s6, respectively. The latter then closes the socket */
|
||||
if (!strcmp(buf, "READY=1\n") || !strcmp(buf, "\n")) {
|
||||
if (!strcmp(buf, "READY=1\n") || buf[len - 1] == '\n') {
|
||||
/*
|
||||
* native (pidfile) services are marked as started by
|
||||
* the pidfile plugin.
|
||||
|
||||
Reference in New Issue
Block a user