From 19545d58da11e9d2bcce777d83daccc98017f5c0 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 18 Apr 2024 14:07:08 +0000 Subject: Prepare for 0.5.4.3; get rid of 1st limit in s6-rc-fdholder-filler Signed-off-by: Laurent Bercot --- COPYING | 2 +- NEWS | 6 ++++++ doc/index.html | 8 ++++---- doc/upgrade.html | 11 ++++++++++ package/info | 2 +- src/s6-rc/s6-rc-fdholder-filler.c | 43 +++++++++++++++++++++++---------------- 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/COPYING b/COPYING index c0a0ab4..2475f17 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2015-2023 Laurent Bercot +Copyright (c) 2015-2024 Laurent Bercot Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/NEWS b/NEWS index 4b41cff..e4b5001 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ Changelog for s6-rc. +In 0.5.4.3 +---------- + + - Bugfixes. + + In 0.5.4.2 ---------- diff --git a/doc/index.html b/doc/index.html index 3b774d6..e27eb70 100644 --- a/doc/index.html +++ b/doc/index.html @@ -48,12 +48,12 @@ scripts are also run in a controlled environment.
  • A POSIX-compliant system with a standard C development environment
  • GNU make, version 3.81 or later
  • skalibs version -2.14.0.0 or later. It's a build-time requirement. It's also a run-time +2.14.1.1 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.4.0 or later. It's a build-time and run-time requirement.
  • +2.9.5.1 or later. It's a build-time and run-time requirement.
  • s6 version -2.12.0.0 or later. It's a build-time and run-time requirement.
  • +2.12.0.5 or later. It's a build-time and run-time requirement.

    Licensing

    @@ -67,7 +67,7 @@ requirement if you link against the shared version of the skalibs library.
    • The current released version of s6-rc is -0.5.4.2.
    • +0.5.4.3.
    • Alternatively, you can checkout a copy of the s6-rc git repository: diff --git a/doc/upgrade.html b/doc/upgrade.html index 64eeec3..89f49d6 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -30,6 +30,17 @@ minor and bugfix version changes.

      What has changed in s6-rc

      +

      in 0.5.4.3

      + +
        +
      • skalibs +dependency bumped to 2.14.1.1.
      • +
      • execline +dependency bumped to 2.9.5.1.
      • +
      • s6 +dependency bumped to 2.12.0.5.
      • +
      +

      in 0.5.4.2

        diff --git a/package/info b/package/info index 9a9e245..8f6e8ad 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-rc -version=0.5.4.2 +version=0.5.4.3 category=admin package_macro_name=S6RC diff --git a/src/s6-rc/s6-rc-fdholder-filler.c b/src/s6-rc/s6-rc-fdholder-filler.c index 81023bc..3f9b509 100644 --- a/src/s6-rc/s6-rc-fdholder-filler.c +++ b/src/s6-rc/s6-rc-fdholder-filler.c @@ -5,20 +5,22 @@ #include #include -#include #include +#include #include #include +#include +#include #include #define USAGE "s6-rc-fdholder-filler [ -1 ] [ -t timeout ] < autofilled-filename" #define dieusage() strerr_dieusage(100, USAGE) +#define dienomem() strerr_diefu1sys(111, "stralloc_catb") #define N 16384 -#define BUFSIZE 65536 -static inline unsigned int class (char c) +static inline unsigned int cclass (char c) { switch (c) { @@ -32,27 +34,37 @@ static inline unsigned int class (char c) } } -static inline unsigned int parse_servicenames (char *s, size_t *indices) +static inline char cnext (void) { - static unsigned char const table[3][5] = + char c ; + ssize_t r = buffer_get(buffer_0, &c, 1) ; + if (r == -1) strerr_diefu1sys(111, "read from stdin") ; + return r ? c : 0 ; +} + +static inline unsigned int parse_servicenames (stralloc *sa, size_t *indices) +{ + static uint8_t const table[3][5] = { { 3, 0, 1, 0, 6 }, { 3, 0, 1, 1, 1 }, { 3, 8, 2, 2, 2 } } ; - size_t pos = 0 ; + size_t pos = sa->len ; size_t n = 0 ; unsigned int state = 0 ; for (; state < 3 ; pos++) { - unsigned char c = table[state][class(s[pos])] ; + char cur = cnext() ; + uint8_t c = table[state][cclass(cur)] ; state = c & 3 ; if (c & 4) { if (n >= N) strerr_dief1x(1, "too many fds") ; indices[n++] = pos ; } - if (c & 8) s[pos] = 0 ; + if (c & 8) { if (!stralloc_0(sa)) dienomem() ; } + else if (!stralloc_catb(sa, &cur, 1)) dienomem() ; } return n ; } @@ -60,11 +72,11 @@ static inline unsigned int parse_servicenames (char *s, size_t *indices) int main (int argc, char const *const *argv) { s6_fdholder_t a = S6_FDHOLDER_ZERO ; + stralloc sa = STRALLOC_ZERO ; tain deadline ; int notif = 0 ; size_t n ; size_t indices[N] ; - char buf[BUFSIZE] ; PROG = "s6-rc-fdholder-filler" ; { unsigned int t = 0 ; @@ -85,12 +97,7 @@ int main (int argc, char const *const *argv) else deadline = tain_infinite_relative ; } - { - size_t r = allread(0, buf, BUFSIZE) ; - if (r >= BUFSIZE) strerr_dief3x(100, "file ", argv[0], " is too big") ; - buf[r] = 0 ; - } - n = parse_servicenames(buf, indices) ; + n = parse_servicenames(&sa, indices) ; if (n) { tain offset = { .sec = TAI_ZERO } ; @@ -103,11 +110,11 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; for (; i < n ; i++) { - size_t len = strlen(buf + indices[i]) ; + size_t len = strlen(sa.s + indices[i]) ; if (len + 12 > S6_FDHOLDER_ID_SIZE) { errno = ENAMETOOLONG ; - strerr_diefu2sys(111, "create identifier for ", buf + indices[i]) ; + strerr_diefu2sys(111, "create identifier for ", sa.s + indices[i]) ; } if (pipe(p) < 0) strerr_diefu1sys(111, "create pipe") ; @@ -116,7 +123,7 @@ int main (int argc, char const *const *argv) offset.nano = i << 1 ; tain_add(&dump[i<<1].limit, &dump[i<<1].limit, &offset) ; memcpy(dump[i<<1].id, "pipe:s6rc-r-", 12) ; - memcpy(dump[i<<1].id + 12, buf + indices[i], len + 1) ; + memcpy(dump[i<<1].id + 12, sa.s + indices[i], len + 1) ; dump[(i<<1)+1].fd = p[1] ; offset.nano = 1 ; tain_add(&dump[(i<<1)+1].limit, &dump[i<<1].limit, &offset) ; -- cgit v1.2.3