From 0eb06a992d6f9644d107338df792d49355ef8e40 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 30 Oct 2025 05:04:21 +0000 Subject: Add s6-rc-set-change doc page, update deps, fix verbosity guard --- INSTALL | 2 +- doc/index.html | 6 +-- doc/s6-rc-set-change.html | 105 ++++++++++++++++++++++++++++++++++++++++++++ doc/upgrade.html | 2 +- src/repo/s6-rc-set-change.c | 4 +- src/repo/s6rc_repo_badsub.c | 10 ++--- 6 files changed, 115 insertions(+), 14 deletions(-) create mode 100644 doc/s6-rc-set-change.html diff --git a/INSTALL b/INSTALL index 31166b4..b18f8e7 100644 --- a/INSTALL +++ b/INSTALL @@ -7,7 +7,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - skalibs version 2.14.5.0 or later: https://skarnet.org/software/skalibs/ - - execline version 2.9.7.1 or later: https://skarnet.org/software/execline/ + - execline version 2.9.8.0 or later: https://skarnet.org/software/execline/ - s6 version 2.13.3.0 or later: https://skarnet.org/software/s6/ This software will run on any operating system that implements diff --git a/doc/index.html b/doc/index.html index 9ede9bc..9a40af7 100644 --- a/doc/index.html +++ b/doc/index.html @@ -52,7 +52,7 @@ scripts are also run in a controlled environment. 2.14.5.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library.
  • execline version -2.9.7.1 or later. It's a build-time and run-time requirement.
  • +2.9.8.0 or later. It's a build-time and run-time requirement.
  • s6 version 2.13.3.0 or later. It's a build-time and run-time requirement.
  • @@ -68,7 +68,7 @@ requirement if you link against the shared version of the skalibs library. diff --git a/doc/s6-rc-set-change.html b/doc/s6-rc-set-change.html new file mode 100644 index 0000000..5a0d41b --- /dev/null +++ b/doc/s6-rc-set-change.html @@ -0,0 +1,105 @@ + + + + + + s6-rc: the s6-rc-set-change program + + + + + + +

    +s6-rc
    +Software
    +skarnet.org +

    + +

    The s6-rc-set-change program

    + +

    + s6-rc-set-change modifies a set by changing +the sub of some services. +

    + +

    Interface

    + +
    +     s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] set newsub services...
    +
    + + + +

    Options

    + +
    +
    -v verbosity, --verbosity=verbosity
    +
    Be more or less verbose. The default is 1, which means +that error messages and warnings will be written to stderr. 0 means that only +error messages will be written, and 2 or more adds informational messages.
    + +
    -r repo, --repository=repo
    +
    Use the repository in repo, which must exist. Default is +/var/lib/s6-rc/repository. +
    + +
    -E, --force-essential
    +
    This option is necessary in order if newsub is always. +Without that option, s6-rc-set-change refuses to set services to always.
    + +
    -f, --ignore-dependencies
    +
    Change services... to newsub, but do not change any other +services, even if the dependency graph would normally mandate it. This may result +in an inconsistent set that you cannot commit.
    +
    + +
    -I action, --if-dependencies-found=action
    +
    Determine what to do if a dependency would make the set inconsistent. +For instance, if service A depends on service B, they are both +in the latent sub, and you are trying to change A to active +without mentioning B, this would not work: in order to be brought up at +boot time, A would first need B to also be brought up at boot time, +so A can only be active if B also is. In that situation, +what s6-rc-set-change does depends on the value of action: + + The warning messages are not printed if verbosity is 0.
    + +
    -n, --dry-run
    +
    Check whether the command would succeed, print warning or error messages if +appropriate, but do not perform the actual modifications.
    + +

    Exit codes

    + +
    +
    0
    Success.
    +
    1
    -I fail was given and dependencies prevented services... +from being changed to newsub.
    +
    3
    A service in services... was not found in the reference database. +
    4
    Invalid or corrupted reference database.
    +
    100
    Incorrect usage.
    +
    102
    Inconsistent repository.
    +
    111
    System call failed.
    +
    + +

    Notes

    + + + + + diff --git a/doc/upgrade.html b/doc/upgrade.html index e77f2d6..dba10f9 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -36,7 +36,7 @@ minor and bugfix version changes.
  • skalibs dependency bumped to 2.14.5.0.
  • execline -dependency bumped to 2.9.7.1.
  • +dependency bumped to 2.9.8.0.
  • s6 dependency bumped to 2.13.3.0.
  • diff --git a/src/repo/s6-rc-set-change.c b/src/repo/s6-rc-set-change.c index 2758fa6..d5ca4ed 100644 --- a/src/repo/s6-rc-set-change.c +++ b/src/repo/s6-rc-set-change.c @@ -17,7 +17,7 @@ #include #include -#define USAGE "s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] set newstate services..." +#define USAGE "s6-rc-set-change [ -v verbosity ] [ -r repo ] [ -E ] [ -f | -I fail|pull|warn ] [ -n ] set newsub services..." #define dieusage() strerr_dieusage(100, USAGE) enum golb_e @@ -180,7 +180,7 @@ int main (int argc, char const *const *argv) { uint32_t const *bads = genalloc_s(uint32_t, &indices) ; uint32_t badn = genalloc_len(uint32_t, &indices) ; - if (verbosity) + if (verbosity || !forcelevel) { char const *arg[10 + (badn << 1)] ; arg[0] = PROG ; diff --git a/src/repo/s6rc_repo_badsub.c b/src/repo/s6rc_repo_badsub.c index 69697eb..246396c 100644 --- a/src/repo/s6rc_repo_badsub.c +++ b/src/repo/s6rc_repo_badsub.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -13,11 +14,6 @@ #include -static int strqcmp (void const *a, void const *b) -{ - return strcmp(*(char const *const *)a, *(char const *const *)b) ; -} - int s6rc_repo_badsub (char const *repo, char const *set, char const **services, uint32_t n, uint8_t newsub, uint8_t what, s6rc_repo_sv const *svlist, uint32_t ntot, stralloc *sa, genalloc *badga) { int sawasnull = !!sa->s ; @@ -33,7 +29,7 @@ int s6rc_repo_badsub (char const *repo, char const *set, char const **services, mid = genalloc_len(size_t, &fulldeps) ; if (newsub > 0 && (what & 2) && s6rc_repo_listalldeps(repo, services, n, sa, &fulldeps, 1)) goto err ; - qsort(services, n, sizeof(char const *), &strqcmp) ; + qsort(services, n, sizeof(char const *), &str_cmp) ; fulln = genalloc_len(size_t, &fulldeps) ; ind = genalloc_s(size_t, &fulldeps) ; @@ -41,7 +37,7 @@ int s6rc_repo_badsub (char const *repo, char const *set, char const **services, { s6rc_repo_sv *p ; char const *cur = sa->s + ind[i] ; - if (bsearch(&cur, services, n, sizeof(char const *), &strqcmp)) continue ; + if (bsearch(&cur, services, n, sizeof(char const *), &str_cmp)) continue ; p = bsearchr(cur, svlist, ntot, sizeof(s6rc_repo_sv), &s6rc_repo_sv_bcmpr, sa->s) ; if (!p) { -- cgit v1.3.1