From b4070f01c00a07d4f2df6a3ff85eb6f2b1386b84 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 27 Feb 2022 00:47:51 +0000 Subject: Add noclamp option to s6-envdir Signed-off-by: Laurent Bercot --- doc/s6-envdir.html | 9 +++++++-- src/daemontools-extras/s6-envdir.c | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/s6-envdir.html b/doc/s6-envdir.html index 6392963..17577b4 100644 --- a/doc/s6-envdir.html +++ b/doc/s6-envdir.html @@ -25,7 +25,7 @@ s6-envdir changes its environment, then executes into another program.

Interface

-     s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -c nullis ] dir prog...
+     s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -L ] [ -c nullis ] dir prog...
 

Options

@@ -52,6 +52,11 @@ option is not given). Null characters are still translated. file ends with a newline, keep that last newline in the value. If the -f option is not given, keep the trailing blanks at the end of the first line (but not the ending newline). +
  • -L : do not clamp. With this option, s6-envdir will process +the whole first line of each file (if the -f option hasn't been given) +or read each file entirely (if the -f option has been given), even if +it means adding huge variables to the environment. Without this option, s6-envdir +only reads the first 4096 bytes of each file.
  • -c nullis : replace null characters with the first character of nullis instead of a newline.
  • diff --git a/src/daemontools-extras/s6-envdir.c b/src/daemontools-extras/s6-envdir.c index 4c297ea..9b98b4a 100644 --- a/src/daemontools-extras/s6-envdir.c +++ b/src/daemontools-extras/s6-envdir.c @@ -8,7 +8,7 @@ #include #include -#define USAGE "s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -c nullchar ] dir prog..." +#define USAGE "s6-envdir [ -I | -i ] [ -n ] [ -f ] [ -L ] [ -c nullchar ] dir prog..." int main (int argc, char const *const *argv) { @@ -20,7 +20,7 @@ int main (int argc, char const *const *argv) PROG = "s6-envdir" ; for (;;) { - int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ; + int opt = subgetopt_r(argc, argv, "IinfLc:", &l) ; if (opt == -1) break ; switch (opt) { @@ -28,6 +28,7 @@ int main (int argc, char const *const *argv) case 'i' : insist = 1 ; break ; case 'n' : options |= SKALIBS_ENVDIR_NOCHOMP ; break ; case 'f' : options |= SKALIBS_ENVDIR_VERBATIM ; break ; + case 'L' : options |= SKALIBS_ENVDIR_NOCLAMP ; break ; case 'c' : nullis = *l.arg ; break ; default : strerr_dieusage(100, USAGE) ; } -- cgit v1.3.1