search for: error_flagged

Displaying 20 results from an estimated 20 matches for "error_flagged".

2018 Feb 02
0
[RFC nbdkit PATCH] utils: Revamp nbdkit_parse_size
...ENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <config.h> + +#include <stdio.h> +#include <inttypes.h> +#include <stdbool.h> + +#include <nbdkit-plugin.h> + +static bool error_flagged; + +/* Stub for linking against minimal source files */ +void +nbdkit_error (const char *fs, ...) +{ + error_flagged = true; +} + +static bool +test_nbdkit_parse_size (void) +{ + bool pass = true; + struct pair { + const char *str; + int64_t res; + } pairs[] = { + /* Bogus strings */ +...
2018 Feb 07
3
[nbdkit PATCH v2 0/2] Improve nbdkit_parse_size
Take two, this time split into two patches. I liked Rich's suggestion of unit-testing src/ files directly in src/, and automake is a lot happier with this than with my v1 attempt that tried to compile .c files across directories. It's still enough of a change that I'm not pushing it right away. Eric Blake (2): build: Add unit-testing of internal files utils: Revamp
2020 Apr 14
0
[nbdkit PATCH v2 1/3] server: Add nbdkit_stdio_safe
.../* 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 @@ -53,6 +53,8 @@ nbdkit_error (const char *fs, ...) error_flagged = true; } +bool listen_stdin; + volatile int quit; int quit_fd = -1; @@ -427,7 +429,24 @@ test_nbdkit_read_password (void) pass = false; } - /* XXX Testing reading from stdin would require setting up a pty */ + /* XXX Testing reading from stdin would require setting up a pty. But +...
2020 Apr 04
0
[nbdkit PATCH 1/2] server: Add nbdkit_stdio_safe
.../* 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 @@ -53,6 +53,8 @@ nbdkit_error (const char *fs, ...) error_flagged = true; } +bool listen_stdin; + volatile int quit; int quit_fd = -1; @@ -427,7 +429,24 @@ test_nbdkit_read_password (void) pass = false; } - /* XXX Testing reading from stdin would require setting up a pty */ + /* XXX Testing reading from stdin would require setting up a pty. But +...
2019 Sep 23
0
Re: [PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...dkit_parse_ints (void) > +{ > + bool pass = true; > + > +#define PARSE(...) PARSE_(__VA_ARGS__) > +#define PARSE_(TYPE, FORMAT, TEST, RET, EXPECTED) \ > + do { \ Alignment is off. > + error_flagged = false; \ > + TYPE i = 0; \ Ooh, we could also test that *r is unchanged on failure. Here, assign TYPE i = 123; (or something unlikely and unused elsewhere, remembering that we have to fit i...
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...t's just harder to remove something we don't like than to add something we found to be missing. >>> +#define PARSE(TYPE, FORMAT, TEST, RET, EXPECTED) \ >>> + do { \ >>> + error_flagged = false; \ >>> + TYPE i = 0; \ >>> + int r = nbdkit_parse_##TYPE ("test", TEST, &i); \ >>> + if (r != RET || i != EXPECTED) {...
2019 Jul 31
13
[nbdkit PATCH 0/8] fd leak safety
There's enough here to need a review; some of it probably needs backporting to stable-1.12. This probably breaks tests on Haiku or other platforms that have not been as on-the-ball about atomic CLOEXEC; feel free to report issues that arise, and I'll help come up with workarounds (even if we end up leaving a rare fd leak on less-capable systems). Meanwhile, I'm still working on my
2019 Sep 23
2
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...t; +test_nbdkit_parse_ints (void) > > +{ > > + bool pass = true; > > + char s[64]; > > + > > +#define PARSE(TYPE, FORMAT, TEST, RET, EXPECTED) \ > > + do { \ > > + error_flagged = false; \ > > + TYPE i = 0; \ > > + int r = nbdkit_parse_##TYPE ("test", TEST, &i); \ > > + if (r != RET || i != EXPECTED) {...
2019 Sep 23
2
[PATCH nbdkit v2] server: public: Add nbdkit_parse_* functions for safely parsing integers.
..._size (void) return pass; } +static bool +test_nbdkit_parse_ints (void) +{ + bool pass = true; + +#define PARSE(...) PARSE_(__VA_ARGS__) +#define PARSE_(TYPE, FORMAT, TEST, RET, EXPECTED) \ + do { \ + error_flagged = false; \ + TYPE i = 0; \ + int r = nbdkit_parse_##TYPE ("test", TEST, &i); \ + if (r != RET || i != EXPECTED) { \ +...
2019 Sep 21
2
[PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...7,180 @@ test_nbdkit_parse_size (void) return pass; } +static bool +test_nbdkit_parse_ints (void) +{ + bool pass = true; + char s[64]; + +#define PARSE(TYPE, FORMAT, TEST, RET, EXPECTED) \ + do { \ + error_flagged = false; \ + TYPE i = 0; \ + int r = nbdkit_parse_##TYPE ("test", TEST, &i); \ + if (r != RET || i != EXPECTED) { \ +...
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):
2019 Sep 23
0
Re: [PATCH nbdkit] server: public: Add nbdkit_parse_* functions for safely parsing integers.
...test-public.c > +static bool > +test_nbdkit_parse_ints (void) > +{ > + bool pass = true; > + char s[64]; > + > +#define PARSE(TYPE, FORMAT, TEST, RET, EXPECTED) \ > + do { \ > + error_flagged = false; \ > + TYPE i = 0; \ > + int r = nbdkit_parse_##TYPE ("test", TEST, &i); \ > + if (r != RET || i != EXPECTED) {...
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 |
2019 Oct 17
2
[PATCH nbdkit] server: Allow file descriptors to be passed to nbdkit_read_password.
...quot;) != 0) { + fprintf (stderr, "Wrong file password, expected 'abc' got '%s'\n", pw); + pass = false; + } + free (pw); + } + + if (fd >= 0) { + /* Don't close fd, it is closed by nbdkit_read_password. */ + unlink (template2); + } + if (error_flagged) { fprintf (stderr, "Wrong error message handling\n"); pass = false; -- 2.23.0
2019 Mar 19
0
[PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...uot; +#include "random.h" + +#include "internal.h" + +extern void dump_extents_map (const struct nbdkit_extents_map *map); +extern void validate_extents_map (const struct nbdkit_extents_map *map); + +#define DISK_SIZE (1<<10) +static uint8_t disk[DISK_SIZE]; + +static bool error_flagged = false; + +/* Stub for linking against server/extents.c. */ +void +nbdkit_error (const char *fs, ...) +{ + error_flagged = true; +} + +static int +compare (uint64_t offset, uint64_t length, uint32_t type, void *mapv) +{ + const struct nbdkit_extents_map *map = mapv; + size_t j; + + /* nbdkit_e...
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 2/5] lib: Move code for parsing, passwords and paths into libnbdkit.so.
...lib/test-public.c index fe347d44..d680e7ad 100644 --- a/server/test-public.c +++ b/lib/test-public.c @@ -41,7 +41,8 @@ #include <string.h> #include <unistd.h> -#include "internal.h" +#include "nbdkit-plugin.h" +#include "nbdkit-filter.h" static bool error_flagged; diff --git a/.gitignore b/.gitignore index 4bb035e1..2f9d45a9 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ plugins/*/*.3 /include/nbdkit-version.h /INSTALL /install-sh +/lib/test-public /libtool /ltmain.sh /missing @@ -80,7 +81,6 @@ plugins/*/*.3 /server/nbdkit /server/nbdk...
2019 Mar 19
15
[PATCH nbdkit 0/9] [mainly for discussion and early review] Implement extents.
I want to post this but mainly for discussion and early review. It's not safe for these patches to all go upstream yet (because not all filters have been checked/adjusted), but if any patches were to go upstream then probably 1 & 2 only are safe. File, VDDK, memory and data plugins all work, although I have only done minimal testing on them. The current tests, such as they are, all
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.
2020 Aug 20
15
[PATCH nbdkit 0/13] Port to Windows without using a separate library.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw-nolib After a lot of work I have made the port to Windows work without using a separate library. Instead, on Windows only, we build an "import library" (library of stubs) which resolves references to nbdkit_* functions in the main program and fixes up the plugin, basically the first technique outlined in
2020 Mar 26
15
[PATCH nbdkit 0/9] Create libnbdkit.so
This creates libnbdkit.so as discussed in the following thread: https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00203 test-delay-shutdown.sh fails for unclear reasons. This series starts by reverting "tests: Don't strand hung nbdkit processes" which is because several other tests fail randomly unless I revert this patch. I didn't investigate this yet so it