Displaying 20 results from an estimated 22 matches for "passthru_format".
2018 Nov 14
2
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...; +static const char **cmd;
> +static size_t len;
> +
> +static void
> +passthru (const char *s)
> +{
> + cmd = realloc (cmd, (len+1) * sizeof (const char *));
> + if (cmd == NULL)
> + abort ();
> + cmd[len] = s;
> + ++len;
> +}
> +
> +static void
> +passthru_format (const char *fs, ...)
I'd give this a gcc __attribute__((printf...)), so that the compiler can
help diagnose misuse.
> +{
> + va_list args;
> + char *str;
> +
> + va_start (args, fs);
> + if (vasprintf (&str, fs, args) == -1)
> + abort ();
> + va_end (args...
2020 Aug 20
0
[PATCH nbdkit 12/13] wrapper: Port the wrapper to run on Windows.
...);
exit (EXIT_FAILURE);
}
- setenv ("LD_LIBRARY_PATH", s, 1);
+ setenv (LD_LIBRARY_PATH, s, 1);
free (s);
s = getenv ("LIBRARY_PATH");
if (s)
@@ -193,7 +240,7 @@ main (int argc, char *argv[])
free (s);
/* Absolute path of the real nbdkit command. */
- passthru_format ("%s/server/nbdkit", builddir);
+ passthru_format ("%s/server/nbdkit" EXEEXT, builddir);
/* Option parsing. We don't really parse options here. We are only
* interested in which options have arguments and which need
@@ -225,7 +272,8 @@ main (int argc, char *argv[...
2018 Nov 14
0
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...gt; passthrough?
I believe yes, we always need this loop, so that we can test
long_options[long_index].has_arg.
> >+
> >+ if (c == FILTER_OPTION) {
> >+ /* Filters can be rewritten if purely alphanumeric. */
> >+ if (is_short_name (optarg)) {
> >+ passthru_format ("--%s", /* --filter */
> >+ long_options[long_index].name);
>
> Here, you know that there is no short option for --filter, but you
> ALSO know that the option is spelled exactly "--filter", so why
> bother with formatting the reverse l...
2018 Nov 13
3
[PATCH 0/2] build: Replace ./nbdkit with a C program.
This patch series solves the FreeBSD shebang problem in a completely
different way, and a few other things besides. I propose that we
replace ./nbdkit with a C program. The C program is a straightforward
translation of the shell script.
Some advantages of this approach are:
- We can parse options in exactly the same way as the real program.
- Use the more accurate ‘is_short_name’ test for
2018 Nov 14
0
[PATCH nbdkit v2 2/2] build: Replace ./nbdkit with a C program.
...assed through to real nbdkit. */
+static const char **cmd;
+static size_t len;
+
+static void
+passthru (const char *s)
+{
+ cmd = realloc (cmd, (len+1) * sizeof (const char *));
+ if (cmd == NULL)
+ abort ();
+ cmd[len] = s;
+ ++len;
+}
+
+static void __attribute__((format (printf, 1, 2)))
+passthru_format (const char *fs, ...)
+{
+ va_list args;
+ char *str;
+
+ va_start (args, fs);
+ if (vasprintf (&str, fs, args) == -1)
+ abort ();
+ va_end (args);
+ passthru (str);
+}
+
+static void
+end_passthru (void)
+{
+ passthru (NULL);
+}
+
+static void
+print_command (void)
+{
+ size_t i;
+...
2018 Nov 13
0
[PATCH 2/2] build: Replace ./nbdkit with a C program.
...+/* Construct an array of parameters passed through to real nbdkit. */
+static const char **cmd;
+static size_t len;
+
+static void
+passthru (const char *s)
+{
+ cmd = realloc (cmd, (len+1) * sizeof (const char *));
+ if (cmd == NULL)
+ abort ();
+ cmd[len] = s;
+ ++len;
+}
+
+static void
+passthru_format (const char *fs, ...)
+{
+ va_list args;
+ char *str;
+
+ va_start (args, fs);
+ if (vasprintf (&str, fs, args) == -1)
+ abort ();
+ va_end (args);
+ passthru (str);
+}
+
+static void
+end_passthru (void)
+{
+ passthru (NULL);
+}
+
+static void
+print_command (void)
+{
+ size_t i;
+...
2018 Nov 14
3
[PATCH nbdkit v2 0/2] build: Replace ./nbdkit with a C program.
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-November/msg00147.html
v2:
- Use stdbool for booleans.
- Use __attribute__((format(printf))).
- Don't abort on invalid options, exit with failure instead.
- Preserve long/short option choices in the output.
- Add '=' in long option output, ie. always use --longopt=arg.
- Add "--" parameter
2018 Dec 03
1
Re: [PATCH nbdkit 2/4] valgrind: Add --show-leak-kinds=all and comprehensive list of suppressions.
On 12/3/18 1:01 PM, Richard W.M. Jones wrote:
>
>>> passthru ("--error-exitcode=119");
>>> - passthru_format ("--suppressions=%s/valgrind-suppressions", srcdir);
>>> + passthru_format ("--suppressions=%s/valgrind/suppressions", builddir);
>>
>> Is this still right under VPATH?
>
> I believe so ...? Note this is the generated/concatenated file which
>...
2018 Dec 03
4
Re: [PATCH nbdkit 2/4] valgrind: Add --show-leak-kinds=all and comprehensive list of suppressions.
...r to call our library shutdown to
reclaim all memory that we otherwise stashed in globals - but when we
are just a standalone app, do we really need to worry about memory still
reachable in globals, as that's not a true leak?
> passthru ("--error-exitcode=119");
> - passthru_format ("--suppressions=%s/valgrind-suppressions", srcdir);
> + passthru_format ("--suppressions=%s/valgrind/suppressions", builddir);
Is this still right under VPATH?
> passthru ("--trace-children=no");
> passthru ("--run-libc-freeres=no")...
2018 Nov 14
5
[PATCH nbdkit v3 0/4] build: Replace ./nbdkit with a C program.
v1 was here:
https://www.redhat.com/archives/libguestfs/2018-November/msg00147.html
v2 was here:
https://www.redhat.com/archives/libguestfs/2018-November/msg00152.html
v3:
- Use optarg != NULL as a sentinel for has_arg.
- Moved some variable decls into the inner loop.
- Make nbdkit wrapper depend on config.status, so if srcdir or
builddir changes then we rebuild the wrapper. It
2018 Dec 03
0
Re: [PATCH nbdkit 2/4] valgrind: Add --show-leak-kinds=all and comprehensive list of suppressions.
...al error this
revealed was the memory leak in the bitmap patch
(https://www.redhat.com/archives/libguestfs/2018-December/msg00007.html),
and a lot of false positives which I worked my way through with a list
of suppressions.
> > passthru ("--error-exitcode=119");
> >- passthru_format ("--suppressions=%s/valgrind-suppressions", srcdir);
> >+ passthru_format ("--suppressions=%s/valgrind/suppressions", builddir);
>
> Is this still right under VPATH?
I believe so ...? Note this is the generated/concatenated file which
is why I changed srcdir to...
2018 Dec 02
10
[PATCH nbdkit 0/4] Multiple valgrind improvements and possible security fix.
I worked out why valgrind wasn't being applied to nbdkit when run by
many of the tests (patches 1-2). Unfortunately I'm not able to make
it actually fail tests when valgrind fails. Although the situation is
marginally improved in that you can now manually examine the *.log
files and find valgrind failures that way. Also adds valgrinding of
the Python plugin (patch 3).
Along the way I
2020 Mar 26
1
Re: [PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
...in lock-step.
> + }
> +}
> diff --git a/wrapper.c b/wrapper.c
> index 6aef81a1..eb0ba8ba 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -193,7 +199,7 @@ main (int argc, char *argv[])
> free (s);
>
> /* Absolute path of the real nbdkit command. */
> - passthru_format ("%s/server/nbdkit", builddir);
> + passthru_format ("%s/server/.libs/nbdkit", builddir);
Yep, I remember having to tweak that when playing with earlier attempts
to fix dlopen() in VDDK.
> +++ b/lib/libnbdkit.syms
> +
> +# This linker script controls the visibil...
2018 Dec 02
0
[PATCH nbdkit 2/4] valgrind: Add --show-leak-kinds=all and comprehensive list of suppressions.
...--- a/wrapper.c
+++ b/wrapper.c
@@ -130,8 +130,9 @@ main (int argc, char *argv[])
passthru (VALGRIND);
passthru ("--vgdb=no");
passthru ("--leak-check=full");
+ passthru ("--show-leak-kinds=all");
passthru ("--error-exitcode=119");
- passthru_format ("--suppressions=%s/valgrind-suppressions", srcdir);
+ passthru_format ("--suppressions=%s/valgrind/suppressions", builddir);
passthru ("--trace-children=no");
passthru ("--run-libc-freeres=no");
passthru ("--num-callers=20");
--...
2018 Dec 02
0
[PATCH nbdkit 1/4] valgrind: Remove --child-silent-after-fork.
...the leak will
still get printed in the log.
---
wrapper.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/wrapper.c b/wrapper.c
index e5f74a2..eb50108 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -133,7 +133,6 @@ main (int argc, char *argv[])
passthru ("--error-exitcode=119");
passthru_format ("--suppressions=%s/valgrind-suppressions", srcdir);
passthru ("--trace-children=no");
- passthru ("--child-silent-after-fork=yes");
passthru ("--run-libc-freeres=no");
passthru ("--num-callers=20");
}
--
2.19.0.rc0
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
...f (&s, "%s/lib/.libs:%s/plugins/ocaml/.libs",
+ builddir, builddir);
if (r < 0) {
perror ("asprintf");
exit (EXIT_FAILURE);
@@ -193,7 +199,7 @@ main (int argc, char *argv[])
free (s);
/* Absolute path of the real nbdkit command. */
- passthru_format ("%s/server/nbdkit", builddir);
+ passthru_format ("%s/server/.libs/nbdkit", builddir);
/* Option parsing. We don't really parse options here. We are only
* interested in which options have arguments and which need
diff --git a/lib/libnbdkit.syms b/lib/libnbdkit....
2018 Dec 02
0
[PATCH nbdkit 3/4] valgrind: Enable valgrinding of Python plugin.
...:PyRun_SimpleFileExFlags
+}
+
+# This seems like a bug in Python itself.
+{
+ python_5
+ Memcheck:Leak
+ fun:malloc
+ ...
+ fun:Py_Finalize
+}
diff --git a/wrapper.c b/wrapper.c
index 3fd499b..f19c09a 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -135,7 +135,7 @@ main (int argc, char *argv[])
passthru_format ("--suppressions=%s/valgrind/suppressions", builddir);
passthru ("--trace-children=no");
passthru ("--run-libc-freeres=no");
- passthru ("--num-callers=20");
+ passthru ("--num-callers=100");
}
else {
s = getenv ("NBD...
2018 Nov 14
1
Re: [PATCH 2/2] build: Replace ./nbdkit with a C program.
...ck to just no_argument and required_argument, we don't have
to worry about that).
>
>>> +
>>> + if (c == FILTER_OPTION) {
>>> + /* Filters can be rewritten if purely alphanumeric. */
>>> + if (is_short_name (optarg)) {
>>> + passthru_format ("--%s", /* --filter */
>>> + long_options[long_index].name);
>>
>> Here, you know that there is no short option for --filter, but you
>> ALSO know that the option is spelled exactly "--filter", so why
>> bother with forma...
2020 Jun 28
5
[PATCH nbdkit 0/2] tar: Rewrite the tar plugin (again), this time in C.
For context see these threads:
https://lists.gnu.org/archive/html/qemu-discuss/2020-06/threads.html#00053
https://lists.gnu.org/archive/html/qemu-block/2020-06/threads.html#01496
Rich.
2020 Mar 26
9
[PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
This is the previous 5/9 patch posted earlier today, split into
reviewable chunks. This passes bisection with -x 'make && make
check', but I didn't work very hard on the commit messages, so I refer
you back to the original patch to explain how it works:
https://www.redhat.com/archives/libguestfs/2020-March/msg00248.html
Rich.