diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-12-23 13:05:25 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-12-23 13:05:25 +0000 |
commit | 07491df186d562d0efa6a7fca2b7f8d07dbd0652 (patch) | |
tree | d66a8709a82b4c621c5f21a7f346362e8a243a3f /src/libs6 | |
parent | 8bbfc319248c0cbeb57edc45f26d1c972d32f505 (diff) | |
download | s6-07491df186d562d0efa6a7fca2b7f8d07dbd0652.tar.xz |
Make execline dependency optional
This includes:
- adding a configure option to disable execline support
- duplicating el_semicolon() and el_getstrict() into the s6 library
when execline is disabled at build time, making a compat shim and
using it where needed (s6-svlisten, s6-ftrig-listen)
- Creating alternatives for execlineb script spawning:
* s6-log: '?' directive (done in the previous commit)
* s6-notifyoncheck: require hardcoding the check in ./data/check
* s6-ipcserver-access: no support for exec files, add a warning
- Updating the relevant parts of the doc
--enable-execline will remain the default, and whiners can choke
on their tears.
Diffstat (limited to 'src/libs6')
-rw-r--r-- | src/libs6/deps-lib/s6 | 5 | ||||
-rw-r--r-- | src/libs6/s6_compat_el_semicolon.c | 54 |
2 files changed, 57 insertions, 2 deletions
diff --git a/src/libs6/deps-lib/s6 b/src/libs6/deps-lib/s6 index 65612cc..ddd86dc 100644 --- a/src/libs6/deps-lib/s6 +++ b/src/libs6/deps-lib/s6 @@ -26,12 +26,13 @@ s6_accessrules_keycheck_uidgid.o s6_accessrules_params_free.o s6_accessrules_uidgid_cdb.o s6_accessrules_uidgid_fs.o -s6_supervise_lock.o -s6_supervise_lock_mode.o +s6_compat_el_semicolon.o s6_dtally_pack.o s6_dtally_unpack.o s6_dtally_read.o s6_dtally_write.o +s6_supervise_lock.o +s6_supervise_lock_mode.o s6_svc_lock_take.o s6_svc_lock_release.o s6_svc_ok.o diff --git a/src/libs6/s6_compat_el_semicolon.c b/src/libs6/s6_compat_el_semicolon.c new file mode 100644 index 0000000..d6fdd06 --- /dev/null +++ b/src/libs6/s6_compat_el_semicolon.c @@ -0,0 +1,54 @@ +/* ISC license. */ + +#include <s6/config.h> + +#ifndef S6_USE_EXECLINE + +#include <stdlib.h> + +#include <skalibs/types.h> +#include <skalibs/strerr2.h> + +static unsigned int el_getstrict (void) +{ + static unsigned int strict = 0 ; + static int first = 1 ; + if (first) + { + char const *x = getenv("EXECLINE_STRICT") ; + first = 0 ; + if (x) uint0_scan(x, &strict) ; + } + return strict ; +} + +int s6_compat_el_semicolon (char const **argv) +{ + static unsigned int nblock = 0 ; + int argc1 = 0 ; + nblock++ ; + for (;; argc1++, argv++) + { + char const *arg = *argv ; + if (!arg) return argc1 + 1 ; + if (!arg[0]) return argc1 ; + else if (arg[0] == ' ') ++*argv ; + else + { + unsigned int strict = el_getstrict() ; + if (strict) + { + char fmt1[UINT_FMT] ; + char fmt2[UINT_FMT] ; + fmt1[uint_fmt(fmt1, nblock)] = 0 ; + fmt2[uint_fmt(fmt2, (unsigned int)argc1)] = 0 ; + if (strict >= 2) + strerr_dief6x(100, "unquoted argument ", arg, " at block ", fmt1, " position ", fmt2) ; + else + strerr_warnw6x("unquoted argument ", arg, " at block ", fmt1, " position ", fmt2) ; + } + } + } +} + +#endif |