Displaying 20 results from an estimated 25 matches for "wbuflen".
Did you mean:
buflen
2023 Aug 30
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...lugins/sh/call.c
@@ -34,6 +34,7 @@
#include <assert.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
@@ -130,6 +131,7 @@ debug_call (const char **argv)
*/
static int
call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
+ bool *pipe_full, /* set if wbuf not fully written */
string *rbuf, /* read from stdout */
string *ebuf, /* read from stderr */
const char **argv) /* script + pa...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...<assert.h>
> #include <fcntl.h>
> +#include <stdbool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <inttypes.h>
> @@ -130,6 +131,7 @@ debug_call (const char **argv)
> */
> static int
> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> + bool *pipe_full, /* set if wbuf not fully written */
> string *rbuf, /* read from stdout */
> string *ebuf, /* read from stderr */
> const char **argv)...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...<assert.h>
> #include <fcntl.h>
> +#include <stdbool.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <inttypes.h>
> @@ -130,6 +131,7 @@ debug_call (const char **argv)
> */
> static int
> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> + bool *pipe_full, /* set if wbuf not fully written */
> string *rbuf, /* read from stdout */
> string *ebuf, /* read from stderr */
> const char **argv)...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...tl.h>
> > +#include <stdbool.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <inttypes.h>
> > @@ -130,6 +131,7 @@ debug_call (const char **argv)
> > */
> > static int
> > call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> > + bool *pipe_full, /* set if wbuf not fully written */
> > string *rbuf, /* read from stdout */
> > string *ebuf, /* read from stderr */
> > const ch...
2023 Aug 31
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...<fcntl.h>
>> +#include <stdbool.h>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <inttypes.h>
>> @@ -130,6 +131,7 @@ debug_call (const char **argv)
>> */
>> static int
>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
>> + bool *pipe_full, /* set if wbuf not fully written */
>> string *rbuf, /* read from stdout */
>> string *ebuf, /* read from stderr */
>> const char *...
2023 Aug 31
2
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...<stdbool.h>
> >> #include <stdio.h>
> >> #include <stdlib.h>
> >> #include <inttypes.h>
> >> @@ -130,6 +131,7 @@ debug_call (const char **argv)
> >> */
> >> static int
> >> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> >> + bool *pipe_full, /* set if wbuf not fully written */
> >> string *rbuf, /* read from stdout */
> >> string *ebuf, /* read from stderr */
> >>...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...include <stdbool.h>
>>> #include <stdio.h>
>>> #include <stdlib.h>
>>> #include <inttypes.h>
>>> @@ -130,6 +131,7 @@ debug_call (const char **argv)
>>> */
>>> static int
>>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
>>> + bool *pipe_full, /* set if wbuf not fully written */
>>> string *rbuf, /* read from stdout */
>>> string *ebuf, /* read from stderr */
>>>...
2023 Aug 31
2
[PATCH nbdkit] sh: In pwrite, allow scripts to ignore stdin
...-sh-errors.sh \
test-sh-extents.sh \
+ test-sh-pwrite-ignore-stdin.sh \
test-sh-tmpdir-leak.sh \
$(NULL)
diff --git a/plugins/sh/call.c b/plugins/sh/call.c
index 888c6459a..621465252 100644
--- a/plugins/sh/call.c
+++ b/plugins/sh/call.c
@@ -275,22 +275,31 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
r = write (pfds[0].fd, wbuf, wbuflen);
if (r == -1) {
if (errno == EPIPE) {
- /* We tried to write to the script but it didn't consume
- * the data. Probably the script exited without reading
- * from stdin....
2023 Aug 31
0
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...tdio.h>
> >>>> #include <stdlib.h>
> >>>> #include <inttypes.h>
> >>>> @@ -130,6 +131,7 @@ debug_call (const char **argv)
> >>>> */
> >>>> static int
> >>>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> >>>> + bool *pipe_full, /* set if wbuf not fully written */
> >>>> string *rbuf, /* read from stdout */
> >>>> string *ebuf, /* read from...
2020 Apr 15
0
[PATCH nbdkit 8/9] eval, sh: Set $tmpdir before running the command, instead of globally.
...+++++++++
plugins/sh/sh.c | 7 +------
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/plugins/sh/call.h b/plugins/sh/call.h
index 6aa70e56..78305d1e 100644
--- a/plugins/sh/call.h
+++ b/plugins/sh/call.h
@@ -49,4 +49,6 @@ extern exit_code call_write (const char *wbuf, size_t wbuflen,
const char **argv)
__attribute__((__nonnull__ (1, 3)));
+extern char tmpdir[];
+
#endif /* NBDKIT_CALL_H */
diff --git a/plugins/eval/eval.c b/plugins/eval/eval.c
index f09e49f3..3bc7f2a6 100644
--- a/plugins/eval/eval.c
+++ b/plugins/eval/eval.c
@@ -50,7 +50,7...
2023 Aug 31
1
[nbdkit PATCH] sh: Allow pwrite to not consume all data
...>> #include <stdio.h>
> >>> #include <stdlib.h>
> >>> #include <inttypes.h>
> >>> @@ -130,6 +131,7 @@ debug_call (const char **argv)
> >>> */
> >>> static int
> >>> call3 (const char *wbuf, size_t wbuflen, /* sent to stdin (can be NULL) */
> >>> + bool *pipe_full, /* set if wbuf not fully written */
> >>> string *rbuf, /* read from stdout */
> >>> string *ebuf, /* read from stderr */
&g...
2019 Aug 02
0
[nbdkit PATCH v2 14/17] sh: Use pipe2 with CLOEXEC when possible
...fication, are permitted provided that the following conditions are
@@ -32,6 +32,8 @@
#include <config.h>
+#include <assert.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
@@ -94,6 +96,27 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
*rbuflen = *ebuflen = 0;
rbufalloc = ebufalloc = 0;
+#ifdef HAVE_PIPE2
+ if (pipe2 (in_fd, O_CLOEXEC) == -1) {
+ nbdkit_error ("%s: pipe2: %m", script);
+ goto error;
+ }
+ if (pipe2 (out_fd, O_CLOEXEC) == -1) {
+ nbdkit_error ("%s: pipe2: %m&q...
2020 Apr 15
0
[PATCH nbdkit 9/9] eval, sh: Define $nbdkit_safe_stdio = 0|1 in scripts.
...it-plugin(3)>.
+
+=back
+
=head2 Handles
Handles are arbitrary strings, but it is best to limit them to short
diff --git a/plugins/sh/call.c b/plugins/sh/call.c
index b0aaf754..ddb7045b 100644
--- a/plugins/sh/call.c
+++ b/plugins/sh/call.c
@@ -107,6 +107,7 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
{
const char *argv0 = argv[0]; /* script name, used in error messages */
CLEANUP_FREE_STRING_LIST char **env = NULL;
+ const char *stdio_safe_str = nbdkit_stdio_safe () ? "1" : "0";
pid_t pid = -1;
int status;
int ret = ERROR;
@@ -123,8 +124...
2018 Sep 10
1
question on nbdkit sh plugin
...ntial bug in sh.c:
+/* This is the generic function that calls the script. It can
+ * optionally write to the script's stdin and read from the script's
+ * stdout and stderr. It returns the raw error code and does no error
+ * processing.
+ */
+static int
+call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
+ char **rbuf, size_t *rbuflen, /* read from stdout */
+ char **ebuf, size_t *ebuflen, /* read from stderr */
+ const char **argv) /* script + parameters */
+{
...
+
+ execvp (argv[0], (char **) argv);
+ perror (argv[0]);
+ _exi...
2018 Dec 01
1
[nbdkit PATCH] sh: Don't let child inherit SIGPIPE ignored
...ugins/sh/call.c | 3 +++
tests/test-shell.sh | 14 +++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/plugins/sh/call.c b/plugins/sh/call.c
index 9b3eca8..42923da 100644
--- a/plugins/sh/call.c
+++ b/plugins/sh/call.c
@@ -121,6 +121,9 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
close (out_fd[1]);
close (err_fd[1]);
+ /* Restore SIGPIPE back to SIG_DFL, since shell can't undo SIG_IGN */
+ signal (SIGPIPE, SIG_DFL);
+
/* Set $tmpdir for the script. */
setenv ("tmpdir", tmpdir, 1);
diff --git a/tests/test-shell.s...
2019 Aug 02
5
[nbdkit PATCH 0/3] sh plugin fixes
I'm pushing the first one as blatantly obvious.
The second one is also simple enough, but not enough of a bug for me
to push tonight.
The third is something I noticed while working on sh, but is really
more about docs vs. plugins in general. There, we could either change
the code to match the docs (breaking backwards behavior for a plugin
that set .errno_is_preserved=2) [what my patch did],
2019 Jul 31
0
[nbdkit PATCH 9/8] sh: Document CLOEXEC considerations
...t;eblake@redhat.com>
---
plugins/sh/call.c | 4 ++++
plugins/sh/sh.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/plugins/sh/call.c b/plugins/sh/call.c
index 871de5c6..da2651d4 100644
--- a/plugins/sh/call.c
+++ b/plugins/sh/call.c
@@ -94,6 +94,10 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
*rbuflen = *ebuflen = 0;
rbufalloc = ebufalloc = 0;
+ /* As long as we use NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS, we
+ * don't have to worry about CLOEXEC, because we know no other
+ * thread is competing to fork at the same time as this one.
+ */
if (...
2019 Aug 02
0
[nbdkit PATCH 2/3] sh: Avoid setenv after fork
...>
---
plugins/sh/call.c | 3 ---
plugins/sh/sh.c | 6 ++++++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/plugins/sh/call.c b/plugins/sh/call.c
index 871de5c6..9b8b48e2 100644
--- a/plugins/sh/call.c
+++ b/plugins/sh/call.c
@@ -127,9 +127,6 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
/* Restore SIGPIPE back to SIG_DFL, since shell can't undo SIG_IGN */
signal (SIGPIPE, SIG_DFL);
- /* Set $tmpdir for the script. */
- setenv ("tmpdir", tmpdir, 1);
-
execvp (argv[0], (char **) argv);
perror (argv[0]);
_exit (EXIT_F...
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated!
The basic purpose of the patch series is to set $nbdkit_stdio_safe to
"0" or "1" in sh and eval plugin scripts.
To do that, I ended up adding a nicer way to manipulate environ lists,
and to do that, I ended up adding a whole generic vector
implementation which is applicable in a lot of different places.
2019 Aug 02
1
Re: [nbdkit PATCH 2/3] sh: Avoid setenv after fork
...plugins/sh/sh.c | 6 ++++++
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/plugins/sh/call.c b/plugins/sh/call.c
> index 871de5c6..9b8b48e2 100644
> --- a/plugins/sh/call.c
> +++ b/plugins/sh/call.c
> @@ -127,9 +127,6 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */
> /* Restore SIGPIPE back to SIG_DFL, since shell can't undo SIG_IGN */
> signal (SIGPIPE, SIG_DFL);
>
> - /* Set $tmpdir for the script. */
> - setenv ("tmpdir", tmpdir, 1);
> -
> execvp (argv[0], (char **) argv);
>...