Displaying 9 results from an estimated 9 matches for "inline_script".
2018 Dec 14
2
Re: [PATCH nbdkit 1/3] sh: Implement inline scripts.
...erwise the
'-' looks like an option to nbdkit proper rather than a script parameter?
Probably not worth a mention that a local file named '-' can still be
invoked via [script=]./- (there, script is optional because the leading
./ avoids the leading -).
> +static char *
> +inline_script (void)
> +{
> + const char scriptname[] = "inline-script.sh";
> + char *filename = NULL;
> + char *cmd = NULL;
> +
> + if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) {
> + nbdkit_error ("asprintf: %m");
> + goto err;...
2018 Dec 14
0
[PATCH nbdkit 1/3] sh: Implement inline scripts.
...}
}
+/* This implements the "inline script" feature (script=-). Read stdin
+ * into a temporary file and return the name of the file which the
+ * caller must free. For convenience we put the temporary file into
+ * tmpdir but that's an implementation detail.
+ */
+static char *
+inline_script (void)
+{
+ const char scriptname[] = "inline-script.sh";
+ char *filename = NULL;
+ char *cmd = NULL;
+
+ if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) {
+ nbdkit_error ("asprintf: %m");
+ goto err;
+ }
+
+ /* Safe because both the tmpdi...
2018 Dec 15
0
Re: [PATCH nbdkit 1/3] sh: Implement inline scripts.
...the parser. I'll have to do
some more investigations.
Rich.
> Probably not worth a mention that a local file named '-' can still
> be invoked via [script=]./- (there, script is optional because the
> leading ./ avoids the leading -).
>
> >+static char *
> >+inline_script (void)
> >+{
> >+ const char scriptname[] = "inline-script.sh";
> >+ char *filename = NULL;
> >+ char *cmd = NULL;
> >+
> >+ if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) {
> >+ nbdkit_error ("asprintf: %m&...
2018 Dec 14
6
[PATCH nbdkit 0/3] tests: Test export flags (eflags).
Some feature additions to the shell script plugin allow us to test the
export flags field reasonably easily.
Rich.
2020 Apr 14
0
[nbdkit PATCH v2 1/3] server: Add nbdkit_stdio_safe
...+ b/plugins/sh/sh.c
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2018-2019 Red Hat Inc.
+ * Copyright (C) 2018-2020 Red Hat Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -116,6 +116,11 @@ inline_script (void)
char *filename = NULL;
CLEANUP_FREE char *cmd = NULL;
+ if (!nbdkit_stdio_safe ()) {
+ nbdkit_error ("inline script is incompatible with -s");
+ return NULL;
+ }
+
if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) {
nbdkit_error (&quo...
2018 Dec 15
5
[PATCH nbdkit v2 0/4] tests: Test export flags (eflags).
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-December/thread.html#00123
v2:
- Document "-" instead of "script=-" and use it in the test; and
verify this also works on FreeBSD; and verify that it doesn't
depend on the particular behaviour of our wrapper script and should
work with installed nbdkit too.
- Fix handling of zero flags parameter.
-
2020 Apr 04
0
[nbdkit PATCH 1/2] server: Add nbdkit_stdio_safe
...+ b/plugins/sh/sh.c
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2018-2019 Red Hat Inc.
+ * Copyright (C) 2018-2020 Red Hat Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -116,6 +116,11 @@ inline_script (void)
char *filename = NULL;
CLEANUP_FREE char *cmd = NULL;
+ if (!nbdkit_stdio_safe ()) {
+ nbdkit_error ("inline script is incompatible with -s");
+ return NULL;
+ }
+
if (asprintf (&filename, "%s/%s", tmpdir, scriptname) == -1) {
nbdkit_error (&quo...
2020 Apr 04
6
[nbdkit PATCH 0/2] stdin/out cleanups
This is what I've been playing with in response to my earlier question
about what to do with 'nbdkit -s sh -'
(https://www.redhat.com/archives/libguestfs/2020-April/msg00032.html)
I'm still open to ideas on a better name, and/or whether adding
<stdbool.h> to our public include files is a good idea (if not,
returning int instead of bool is tolerable).
Eric Blake (2):
2020 Apr 14
6
[nbdkit PATCH v2 0/3] more consistent stdin/out handling
In v2:
- use int instead of bool in the public header
- split the tests from the code
- don't overload test-layers; instead, add new tests
- add a missing fflush exposed by the new tests
- other minor cleanups
Eric Blake (3):
server: Add nbdkit_stdio_safe
server: Sanitize stdin/out before running plugin code
server: More tests of stdin/out handling
docs/nbdkit-plugin.pod |