[libnbd PATCH 0/6] Paint the pipeline complete green, finally
I hated the fact that it was not finished and it was (is) keeping me awake even though I do not really have tome to do this, but it is finally finished. We can even enable CI notifications to go public if that's something we'd like to do. Anyway, with this I hope I can finally get libnbd CI out of my mind and hopefully move to CI for other projects ASAP. Night night ;) Martin Kletzander (6): info: Require nbdkit >= 1.14 for info-can.sh One more VSOCK include fix macOS: Simple cloexec/nonblock fix macOS: Do not use --version_script Update CI files CI: Add testing on Alpine configure.ac | 10 +++ lib/internal.h | 3 + generator/states-connect-socket-activation.c | 2 +- generator/states-connect.c | 11 ++-- lib/uri.c | 2 + lib/utils.c | 68 ++++++++++++++++++++ lib/Makefile.am | 2 +- .gitlab-ci.yml | 23 +++++++ ci/cirrus/freebsd-12.vars | 4 +- ci/cirrus/freebsd-13.vars | 4 +- ci/cirrus/freebsd-current.vars | 4 +- ci/cirrus/macos-11.vars | 4 +- ci/containers/alpine-314.Dockerfile | 57 ++++++++++++++++ ci/containers/alpine-edge.Dockerfile | 57 ++++++++++++++++ ci/containers/centos-8.Dockerfile | 2 +- ci/containers/centos-stream-8.Dockerfile | 2 +- ci/containers/debian-10.Dockerfile | 2 +- ci/containers/debian-sid.Dockerfile | 2 +- ci/containers/fedora-33.Dockerfile | 2 +- ci/containers/fedora-34.Dockerfile | 2 +- ci/containers/fedora-rawhide.Dockerfile | 2 +- ci/containers/opensuse-leap-152.Dockerfile | 2 +- ci/containers/opensuse-tumbleweed.Dockerfile | 2 +- ci/containers/ubuntu-1804.Dockerfile | 2 +- ci/containers/ubuntu-2004.Dockerfile | 2 +- fuzzing/libnbd-fuzz-wrapper.c | 30 ++++++++- fuzzing/libnbd-libfuzzer-test.c | 30 ++++++++- info/info-can.sh | 4 ++ 28 files changed, 309 insertions(+), 28 deletions(-) create mode 100644 ci/containers/alpine-314.Dockerfile create mode 100644 ci/containers/alpine-edge.Dockerfile -- 2.32.0
The can_cache flag was introduced in 1.13.4, so the tests might fail on an older one. To make the check easier, only run this test with nbdkit >= 1.14 Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- info/info-can.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/info/info-can.sh b/info/info-can.sh index 4154e38e85ba..afa6043e24bc 100755 --- a/info/info-can.sh +++ b/info/info-can.sh @@ -24,6 +24,10 @@ set -x requires nbdkit --version requires nbdkit sh --version +# This test requires nbdkit >= 1.13.3 due to can_cache, check for at least 1.14. +minor=$( nbdkit --dump-config | grep ^version_minor | cut -d= -f2 ) +requires test $minor -ge 14 + # --is read-only and --can write are tested in info-is-read-only.sh # --can connect is tested in info-can-connect.sh -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:03PM +0200, Martin Kletzander wrote:
The can_cache flag was introduced in 1.13.4, so the tests might fail on an older one. To make the check easier, only run this test with nbdkit >= 1.14
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- info/info-can.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/info/info-can.sh b/info/info-can.sh index 4154e38e85ba..afa6043e24bc 100755 --- a/info/info-can.sh +++ b/info/info-can.sh @@ -24,6 +24,10 @@ set -x requires nbdkit --version requires nbdkit sh --version
+# This test requires nbdkit >= 1.13.3 due to can_cache, check for at least 1.14. +minor=$( nbdkit --dump-config | grep ^version_minor | cut -d= -f2 ) +requires test $minor -ge 14
Version tests are fragile (although we are unlikely to ever backport can_cache support to any downstream build of 1.13.x). You could instead check for: nbdkit sh --dump-plugin | grep can_cache as a witness that the nbdkit plugin understands it. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
This file was forgotten in commit e8ed016c34e1. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- lib/uri.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/uri.c b/lib/uri.c index bcecbad5005a..56f47376ed98 100644 --- a/lib/uri.c +++ b/lib/uri.c @@ -32,6 +32,8 @@ #ifdef HAVE_LINUX_VM_SOCKETS_H #include <linux/vm_sockets.h> +#elif HAVE_SYS_VSOCK_H +#include <sys/vsock.h> #endif #include "internal.h" -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:04PM +0200, Martin Kletzander wrote:
This file was forgotten in commit e8ed016c34e1.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- lib/uri.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/uri.c b/lib/uri.c index bcecbad5005a..56f47376ed98 100644 --- a/lib/uri.c +++ b/lib/uri.c @@ -32,6 +32,8 @@
#ifdef HAVE_LINUX_VM_SOCKETS_H #include <linux/vm_sockets.h> +#elif HAVE_SYS_VSOCK_H +#include <sys/vsock.h> #endif
#include "internal.h" -- 2.32.0
ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
This is the most trivial way to fix the issue with macOS not having SOCK_CLOEXEC and SOCK_NONBLOCK. There is not much better way, so this is the only way to make it work on such platform(s). Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- lib/internal.h | 3 + generator/states-connect-socket-activation.c | 2 +- generator/states-connect.c | 11 ++-- lib/utils.c | 68 ++++++++++++++++++++ fuzzing/libnbd-fuzz-wrapper.c | 30 ++++++++- fuzzing/libnbd-libfuzzer-test.c | 30 ++++++++- 6 files changed, 136 insertions(+), 8 deletions(-) diff --git a/lib/internal.h b/lib/internal.h index 01f9d8ab5fea..8a4c189abe65 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -467,4 +467,7 @@ extern char *nbd_internal_printable_buffer (const void *buf, size_t count); extern char *nbd_internal_printable_string (const char *str); extern char *nbd_internal_printable_string_list (char **list); +extern int nbd_internal_socket(int domain, int type, int protocol, bool nonblock); +extern int nbd_internal_socketpair(int domain, int type, int protocol, int *fds); + #endif /* LIBNBD_INTERNAL_H */ diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c index e601c9bb56be..8a2add312bc4 100644 --- a/generator/states-connect-socket-activation.c +++ b/generator/states-connect-socket-activation.c @@ -131,7 +131,7 @@ STATE_MACHINE { return 0; } - s = socket (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); + s = nbd_internal_socket (AF_UNIX, SOCK_STREAM, 0, false); if (s == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socket"); diff --git a/generator/states-connect.c b/generator/states-connect.c index fcac86f36a34..8de12183d627 100644 --- a/generator/states-connect.c +++ b/generator/states-connect.c @@ -52,7 +52,7 @@ STATE_MACHINE { assert (!h->sock); family = h->connaddr.ss_family; - fd = socket (family, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + fd = nbd_internal_socket (family, SOCK_STREAM, 0, true); if (fd == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socket"); @@ -162,9 +162,10 @@ STATE_MACHINE { return -1; } - fd = socket (h->rp->ai_family, - h->rp->ai_socktype|SOCK_NONBLOCK|SOCK_CLOEXEC, - h->rp->ai_protocol); + fd = nbd_internal_socket (h->rp->ai_family, + h->rp->ai_socktype, + h->rp->ai_protocol, + true); if (fd == -1) { SET_NEXT_STATE (%NEXT_ADDRESS); return 0; @@ -227,7 +228,7 @@ STATE_MACHINE { assert (!h->sock); assert (h->argv.ptr); assert (h->argv.ptr[0]); - if (socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, sv) == -1) { + if (nbd_internal_socketpair (AF_UNIX, SOCK_STREAM, 0, sv) == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socketpair"); return 0; diff --git a/lib/utils.c b/lib/utils.c index 260fd6a25796..972cbc5208a7 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <ctype.h> #include <errno.h> +#include <fcntl.h> #include "minmax.h" @@ -258,3 +259,70 @@ nbd_internal_printable_string_list (char **list) return s; } + +int nbd_internal_socket(int domain, + int type, + int protocol, + bool nonblock) +{ + int fd; + +#ifdef __APPLE__ + int flags; +#else + type |= SOCK_CLOEXEC; + if (nonblock) + type |= SOCK_NONBLOCK; +#endif + + fd = socket (domain, type, protocol); + +#ifdef __APPLE__ + if (fd == -1) + return -1; + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close(fd); + return -1; + } + + if (nonblock) { + flags = fcntl (fd, F_GETFL, 0); + if (flags == -1 || + fcntl (fd, F_SETFL, flags|O_NONBLOCK) == -1) { + close(fd); + return -1; + } + } +#endif + + return fd; +} + +int +nbd_internal_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__ + size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + } +#endif + + return ret; +} diff --git a/fuzzing/libnbd-fuzz-wrapper.c b/fuzzing/libnbd-fuzz-wrapper.c index 99a6d803258f..3d127e673e9e 100644 --- a/fuzzing/libnbd-fuzz-wrapper.c +++ b/fuzzing/libnbd-fuzz-wrapper.c @@ -41,6 +41,34 @@ static void client (int s); static void server (int fd, int s); +static int +get_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__ + size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + } +#endif + + return ret; +} + int main (int argc, char *argv[]) { @@ -61,7 +89,7 @@ main (int argc, char *argv[]) } /* Create a connected socket. */ - if (socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, sv) == -1) { + if (get_socketpair (AF_UNIX, SOCK_STREAM, 0, sv) == -1) { perror ("socketpair"); exit (EXIT_FAILURE); } diff --git a/fuzzing/libnbd-libfuzzer-test.c b/fuzzing/libnbd-libfuzzer-test.c index 5ee29b877bdb..0bf988ee8398 100644 --- a/fuzzing/libnbd-libfuzzer-test.c +++ b/fuzzing/libnbd-libfuzzer-test.c @@ -41,6 +41,34 @@ static void client (int sock); static void server (const uint8_t *data, size_t size, int sock); +static int +get_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__ + size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + } +#endif + + return ret; +} + /* This is the entry point called by libFuzzer. */ int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) @@ -49,7 +77,7 @@ LLVMFuzzerTestOneInput (const uint8_t *data, size_t size) int sv[2], r, status; /* Create a connected socket. */ - if (socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, sv) == -1) { + if (nbd_internal_socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, sv) == -1) { perror ("socketpair"); exit (EXIT_FAILURE); } -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:05PM +0200, Martin Kletzander wrote:
This is the most trivial way to fix the issue with macOS not having SOCK_CLOEXEC and SOCK_NONBLOCK. There is not much better way, so this is the only way to make it work on such platform(s).
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- +int nbd_internal_socket(int domain, + int type, + int protocol, + bool nonblock) +{ + int fd; + +#ifdef __APPLE__
Feels too specific; better might be #ifndef SOCK_CLOEXEC.
+ int flags; +#else + type |= SOCK_CLOEXEC; + if (nonblock) + type |= SOCK_NONBLOCK; +#endif + + fd = socket (domain, type, protocol); + +#ifdef __APPLE__
and again
+ if (fd == -1) + return -1; + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close(fd); + return -1;
I'd add a comment documenting that this is a known race when libnbd is used in a multithreaded program, but that we can't work around it without Apple fixing their bug.
+ } + + if (nonblock) { + flags = fcntl (fd, F_GETFL, 0); + if (flags == -1 || + fcntl (fd, F_SETFL, flags|O_NONBLOCK) == -1) { + close(fd); + return -1; + }
This one is not a race, merely an inconvenience.
+ } +#endif + + return fd; +} + +int +nbd_internal_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__
and again
+ size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + }
Do we care about the value of errno left in place after this function fails? Right now, we aren't very careful about what gets left there, but if none of the callers care, we're okay.
+#endif + + return ret; +} diff --git a/fuzzing/libnbd-fuzz-wrapper.c b/fuzzing/libnbd-fuzz-wrapper.c index 99a6d803258f..3d127e673e9e 100644 --- a/fuzzing/libnbd-fuzz-wrapper.c +++ b/fuzzing/libnbd-fuzz-wrapper.c @@ -41,6 +41,34 @@ static void client (int s); static void server (int fd, int s);
+static int +get_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__
again for the #ifdef witness
+ size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + }
Is the fuzzer multithreaded? Or can we just blindly do the workaround ourselves and not worry about trying to use SOCK_CLOEXEC here? Also, it feels like some duplication; can we not reuse nbd_internal_socketpair from the fuzzer? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Fri, Jul 16, 2021 at 03:23:41PM -0500, Eric Blake wrote:
On Tue, Jul 13, 2021 at 11:26:05PM +0200, Martin Kletzander wrote:
diff --git a/fuzzing/libnbd-fuzz-wrapper.c b/fuzzing/libnbd-fuzz-wrapper.c index 99a6d803258f..3d127e673e9e 100644 --- a/fuzzing/libnbd-fuzz-wrapper.c +++ b/fuzzing/libnbd-fuzz-wrapper.c @@ -41,6 +41,34 @@ static void client (int s); static void server (int fd, int s);
+static int +get_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__ + size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + }
Is the fuzzer multithreaded? Or can we just blindly do the workaround ourselves and not worry about trying to use SOCK_CLOEXEC here? Also, it feels like some duplication; can we not reuse nbd_internal_socketpair from the fuzzer?
AFL-type fuzzers which all use libnbd-fuzz-wrapper.c are not multithreaded. They will launch a new process for each test case. I don't think they could easily be multithreaded: part of the goal is to try to make the test program crash, and they also require instrumenting the test binary. As an aside our test case / wrapper also creates a subprocess since it creates a phony NBD server (the child), connects the two processes by a socketpair, and runs libnbd in the parent. (Now that I look again at the code this might be changed to use two threads instead of processes, not that it would make much difference on Linux.) Since the test case never calls exec it doesn't seem to me that we need to set SOCK_CLOEXEC at all, it's just a code cleanliness thing. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
On Sat, Jul 17, 2021 at 04:10:14PM +0100, Richard W.M. Jones wrote:
Is the fuzzer multithreaded? Or can we just blindly do the workaround ourselves and not worry about trying to use SOCK_CLOEXEC here? Also, it feels like some duplication; can we not reuse nbd_internal_socketpair from the fuzzer?
AFL-type fuzzers which all use libnbd-fuzz-wrapper.c are not multithreaded. They will launch a new process for each test case. I don't think they could easily be multithreaded: part of the goal is to try to make the test program crash, and they also require instrumenting the test binary.
As an aside our test case / wrapper also creates a subprocess since it creates a phony NBD server (the child), connects the two processes by a socketpair, and runs libnbd in the parent. (Now that I look again at the code this might be changed to use two threads instead of processes, not that it would make much difference on Linux.)
Since the test case never calls exec it doesn't seem to me that we need to set SOCK_CLOEXEC at all, it's just a code cleanliness thing.
Ah, so the simplest solution might be: #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0 /* This file doesn't use exec */ #endif -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Tue, Jul 13, 2021 at 11:26:05PM +0200, Martin Kletzander wrote:
This is the most trivial way to fix the issue with macOS not having SOCK_CLOEXEC and SOCK_NONBLOCK. There is not much better way, so this is the only way to make it work on such platform(s).
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- lib/internal.h | 3 + generator/states-connect-socket-activation.c | 2 +- generator/states-connect.c | 11 ++-- lib/utils.c | 68 ++++++++++++++++++++ fuzzing/libnbd-fuzz-wrapper.c | 30 ++++++++- fuzzing/libnbd-libfuzzer-test.c | 30 ++++++++- 6 files changed, 136 insertions(+), 8 deletions(-)
diff --git a/lib/internal.h b/lib/internal.h index 01f9d8ab5fea..8a4c189abe65 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -467,4 +467,7 @@ extern char *nbd_internal_printable_buffer (const void *buf, size_t count); extern char *nbd_internal_printable_string (const char *str); extern char *nbd_internal_printable_string_list (char **list);
+extern int nbd_internal_socket(int domain, int type, int protocol, bool nonblock); +extern int nbd_internal_socketpair(int domain, int type, int protocol, int *fds);
Missing whitespace. Also it would be useful to add a comment about what these functions do.
#endif /* LIBNBD_INTERNAL_H */ diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c index e601c9bb56be..8a2add312bc4 100644 --- a/generator/states-connect-socket-activation.c +++ b/generator/states-connect-socket-activation.c @@ -131,7 +131,7 @@ STATE_MACHINE { return 0; }
- s = socket (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0); + s = nbd_internal_socket (AF_UNIX, SOCK_STREAM, 0, false); if (s == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socket"); diff --git a/generator/states-connect.c b/generator/states-connect.c index fcac86f36a34..8de12183d627 100644 --- a/generator/states-connect.c +++ b/generator/states-connect.c @@ -52,7 +52,7 @@ STATE_MACHINE {
assert (!h->sock); family = h->connaddr.ss_family; - fd = socket (family, SOCK_STREAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + fd = nbd_internal_socket (family, SOCK_STREAM, 0, true); if (fd == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socket"); @@ -162,9 +162,10 @@ STATE_MACHINE { return -1; }
- fd = socket (h->rp->ai_family, - h->rp->ai_socktype|SOCK_NONBLOCK|SOCK_CLOEXEC, - h->rp->ai_protocol); + fd = nbd_internal_socket (h->rp->ai_family, + h->rp->ai_socktype, + h->rp->ai_protocol, + true); if (fd == -1) { SET_NEXT_STATE (%NEXT_ADDRESS); return 0; @@ -227,7 +228,7 @@ STATE_MACHINE { assert (!h->sock); assert (h->argv.ptr); assert (h->argv.ptr[0]); - if (socketpair (AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, sv) == -1) { + if (nbd_internal_socketpair (AF_UNIX, SOCK_STREAM, 0, sv) == -1) { SET_NEXT_STATE (%.DEAD); set_error (errno, "socketpair"); return 0; diff --git a/lib/utils.c b/lib/utils.c index 260fd6a25796..972cbc5208a7 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -24,6 +24,7 @@ #include <unistd.h> #include <ctype.h> #include <errno.h> +#include <fcntl.h>
#include "minmax.h"
@@ -258,3 +259,70 @@ nbd_internal_printable_string_list (char **list) return s;
} + +int nbd_internal_socket(int domain, + int type, + int protocol, + bool nonblock) +{ + int fd; + +#ifdef __APPLE__ + int flags; +#else + type |= SOCK_CLOEXEC; + if (nonblock) + type |= SOCK_NONBLOCK; +#endif
As Eric mentioned already, it would be better to depend on whether SOCK_CLOEXEC is defined rather than __APPLE__. Are there platforms where SOCK_NONBLOCK is not defined? I'm guessing from the code below that MacOS is one such platform.
+ fd = socket (domain, type, protocol); + +#ifdef __APPLE__ + if (fd == -1) + return -1; + + if (fcntl (fd, F_SETFD, FD_CLOEXEC) == -1) { + close(fd); + return -1; + } + + if (nonblock) { + flags = fcntl (fd, F_GETFL, 0); + if (flags == -1 || + fcntl (fd, F_SETFL, flags|O_NONBLOCK) == -1) { + close(fd); + return -1; + } + } +#endif + + return fd; +} + +int +nbd_internal_socketpair (int domain, int type, int protocol, int *fds) +{ + int ret; + +#ifdef __APPLE__ + size_t i; +#else + type |= SOCK_CLOEXEC; +#endif + + ret = socketpair (domain, type, protocol, fds); + +#ifdef __APPLE__ + if (ret == 0) { + for (i = 0; i < 2; i++) { + if (fcntl (fds[i], F_SETFD, FD_CLOEXEC) == -1) { + close(fds[0]); + close(fds[1]); + return -1; + } + } + } +#endif + + return ret; +} diff --git a/fuzzing/libnbd-fuzz-wrapper.c b/fuzzing/libnbd-fuzz-wrapper.c index 99a6d803258f..3d127e673e9e 100644 --- a/fuzzing/libnbd-fuzz-wrapper.c +++ b/fuzzing/libnbd-fuzz-wrapper.c
We talked about this file in another part of the thread. In this file (only) I believe it's better to just use: /* This test will never call exec(2). */ #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0 #endif
diff --git a/fuzzing/libnbd-libfuzzer-test.c b/fuzzing/libnbd-libfuzzer-test.c index 5ee29b877bdb..0bf988ee8398 100644 --- a/fuzzing/libnbd-libfuzzer-test.c +++ b/fuzzing/libnbd-libfuzzer-test.c
I'm not sure about this one. It could be that clang/libfuzzer uses multiple threads. But approximately no one cares about libfuzzer (when compared to AFL++/Honggfuzz). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
The linker does not support this option. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- configure.ac | 10 ++++++++++ lib/Makefile.am | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9f6ba03a4773..18a66ee9114f 100644 --- a/configure.ac +++ b/configure.ac @@ -513,6 +513,16 @@ AS_IF([test "x$enable_golang" != "xno"],[ ],[GOLANG=no]) AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"]) +case $host_os in + darwin*) + VERSION_SCRIPT= + ;; + *) + VERSION_SCRIPT="-Wl,--version-script=${srcdir}/libnbd.syms" + ;; +esac +AC_SUBST([VERSION_SCRIPT]) + dnl Produce output files. AC_CONFIG_HEADERS([config.h]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 968e41aa177b..ece50770326e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -78,7 +78,7 @@ libnbd_la_LIBADD = \ $(NULL) libnbd_la_LDFLAGS = \ $(PTHREAD_LIBS) \ - -Wl,--version-script=$(srcdir)/libnbd.syms \ + $(VERSION_SCRIPT) \ -version-info 0:0:0 \ $(NULL) -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:06PM +0200, Martin Kletzander wrote:
The linker does not support this option.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- configure.ac | 10 ++++++++++ lib/Makefile.am | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac index 9f6ba03a4773..18a66ee9114f 100644 --- a/configure.ac +++ b/configure.ac @@ -513,6 +513,16 @@ AS_IF([test "x$enable_golang" != "xno"],[ ],[GOLANG=no]) AM_CONDITIONAL([HAVE_GOLANG],[test "x$GOLANG" != "xno"])
+case $host_os in + darwin*) + VERSION_SCRIPT= + ;; + *) + VERSION_SCRIPT="-Wl,--version-script=${srcdir}/libnbd.syms" + ;; +esac +AC_SUBST([VERSION_SCRIPT]) + dnl Produce output files. AC_CONFIG_HEADERS([config.h])
diff --git a/lib/Makefile.am b/lib/Makefile.am index 968e41aa177b..ece50770326e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -78,7 +78,7 @@ libnbd_la_LIBADD = \ $(NULL) libnbd_la_LDFLAGS = \ $(PTHREAD_LIBS) \ - -Wl,--version-script=$(srcdir)/libnbd.syms \ + $(VERSION_SCRIPT) \ -version-info 0:0:0 \ $(NULL)
ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
- removes valgrind from macOS but makes the package installation not fail because of its installation which cannot be done on macOS. - fixes python update from 3.7 to 3.8 on FreeBSDs and the followup renaming of packages. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- ci/cirrus/freebsd-12.vars | 4 ++-- ci/cirrus/freebsd-13.vars | 4 ++-- ci/cirrus/freebsd-current.vars | 4 ++-- ci/cirrus/macos-11.vars | 4 ++-- ci/containers/centos-8.Dockerfile | 2 +- ci/containers/centos-stream-8.Dockerfile | 2 +- ci/containers/debian-10.Dockerfile | 2 +- ci/containers/debian-sid.Dockerfile | 2 +- ci/containers/fedora-33.Dockerfile | 2 +- ci/containers/fedora-34.Dockerfile | 2 +- ci/containers/fedora-rawhide.Dockerfile | 2 +- ci/containers/opensuse-leap-152.Dockerfile | 2 +- ci/containers/opensuse-tumbleweed.Dockerfile | 2 +- ci/containers/ubuntu-1804.Dockerfile | 2 +- ci/containers/ubuntu-2004.Dockerfile | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/ci/cirrus/freebsd-12.vars b/ci/cirrus/freebsd-12.vars index 28f7cc2bea45..7d07d0d7a751 100644 --- a/ci/cirrus/freebsd-12.vars +++ b/ci/cirrus/freebsd-12.vars @@ -2,7 +2,7 @@ # # $ lcitool variables freebsd-12 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... PACKAGING_COMMAND='pkg' CCACHE='/usr/local/bin/ccache' @@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PYTHON='/usr/local/bin/python3' PIP3='/usr/local/bin/pip-3.7' -PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind' +PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py38-flake8 python3 qemu valgrind' diff --git a/ci/cirrus/freebsd-13.vars b/ci/cirrus/freebsd-13.vars index e577fa5197b8..538dbeae06f8 100644 --- a/ci/cirrus/freebsd-13.vars +++ b/ci/cirrus/freebsd-13.vars @@ -2,7 +2,7 @@ # # $ lcitool variables freebsd-13 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... PACKAGING_COMMAND='pkg' CCACHE='/usr/local/bin/ccache' @@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PYTHON='/usr/local/bin/python3' PIP3='/usr/local/bin/pip-3.7' -PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind' +PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py38-flake8 python3 qemu valgrind' diff --git a/ci/cirrus/freebsd-current.vars b/ci/cirrus/freebsd-current.vars index 01aceca0aaa3..b0b0c23b6b24 100644 --- a/ci/cirrus/freebsd-current.vars +++ b/ci/cirrus/freebsd-current.vars @@ -2,7 +2,7 @@ # # $ lcitool variables freebsd-current libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... PACKAGING_COMMAND='pkg' CCACHE='/usr/local/bin/ccache' @@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PYTHON='/usr/local/bin/python3' PIP3='/usr/local/bin/pip-3.7' -PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py37-flake8 python3 qemu valgrind' +PKGS='autoconf automake bash-completion ca_root_nss ccache diffutils fusefs-libs3 git glib gmake gnutls go gsed jq libev libtool libxml2 nbd-server nbdkit ocaml ocaml-findlib p5-Pod-Simple perl5 pkgconf py38-flake8 python3 qemu valgrind' diff --git a/ci/cirrus/macos-11.vars b/ci/cirrus/macos-11.vars index 0824e81d78ba..53ea348c0130 100644 --- a/ci/cirrus/macos-11.vars +++ b/ci/cirrus/macos-11.vars @@ -2,7 +2,7 @@ # # $ lcitool variables macos-11 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... PACKAGING_COMMAND='brew' CCACHE='/usr/local/bin/ccache' @@ -10,4 +10,4 @@ MAKE='/usr/local/bin/gmake' NINJA='/usr/local/bin/ninja' PYTHON='/usr/local/bin/python3' PIP3='/usr/local/bin/pip3' -PKGS='autoconf automake bash-completion ccache diffutils flake8 git glib gnu-sed gnutls golang jq libev libtool libxml2 make ocaml ocaml-findlib perl pkg-config python3 qemu valgrind' +PKGS='autoconf automake bash-completion ccache diffutils flake8 git glib gnu-sed gnutls golang jq libev libtool libxml2 make ocaml ocaml-findlib perl pkg-config python3 qemu' diff --git a/ci/containers/centos-8.Dockerfile b/ci/containers/centos-8.Dockerfile index 03c917f51d6c..bb4457294fb3 100644 --- a/ci/containers/centos-8.Dockerfile +++ b/ci/containers/centos-8.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile centos-8 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM docker.io/library/centos:8 diff --git a/ci/containers/centos-stream-8.Dockerfile b/ci/containers/centos-stream-8.Dockerfile index 2b124a35f633..051aba4ec1ee 100644 --- a/ci/containers/centos-stream-8.Dockerfile +++ b/ci/containers/centos-stream-8.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile centos-stream-8 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM quay.io/centos/centos:stream8 diff --git a/ci/containers/debian-10.Dockerfile b/ci/containers/debian-10.Dockerfile index bb6abf99fb04..992b2c86911e 100644 --- a/ci/containers/debian-10.Dockerfile +++ b/ci/containers/debian-10.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile debian-10 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM docker.io/library/debian:10-slim diff --git a/ci/containers/debian-sid.Dockerfile b/ci/containers/debian-sid.Dockerfile index 81f76a19f47c..38819625d436 100644 --- a/ci/containers/debian-sid.Dockerfile +++ b/ci/containers/debian-sid.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile debian-sid libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM docker.io/library/debian:sid-slim diff --git a/ci/containers/fedora-33.Dockerfile b/ci/containers/fedora-33.Dockerfile index 207f4a070301..177df083453d 100644 --- a/ci/containers/fedora-33.Dockerfile +++ b/ci/containers/fedora-33.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile fedora-33 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM registry.fedoraproject.org/fedora:33 diff --git a/ci/containers/fedora-34.Dockerfile b/ci/containers/fedora-34.Dockerfile index 47569ff00f5e..b3aac697a1a0 100644 --- a/ci/containers/fedora-34.Dockerfile +++ b/ci/containers/fedora-34.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile fedora-34 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM registry.fedoraproject.org/fedora:34 diff --git a/ci/containers/fedora-rawhide.Dockerfile b/ci/containers/fedora-rawhide.Dockerfile index 8fbaa20d3822..5922c6863af2 100644 --- a/ci/containers/fedora-rawhide.Dockerfile +++ b/ci/containers/fedora-rawhide.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile fedora-rawhide libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM registry.fedoraproject.org/fedora:rawhide diff --git a/ci/containers/opensuse-leap-152.Dockerfile b/ci/containers/opensuse-leap-152.Dockerfile index 42bdc314b387..dda15b7e627f 100644 --- a/ci/containers/opensuse-leap-152.Dockerfile +++ b/ci/containers/opensuse-leap-152.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile opensuse-leap-152 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM registry.opensuse.org/opensuse/leap:15.2 diff --git a/ci/containers/opensuse-tumbleweed.Dockerfile b/ci/containers/opensuse-tumbleweed.Dockerfile index 3e226d3abc53..22af9e533376 100644 --- a/ci/containers/opensuse-tumbleweed.Dockerfile +++ b/ci/containers/opensuse-tumbleweed.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile opensuse-tumbleweed libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM registry.opensuse.org/opensuse/tumbleweed:latest diff --git a/ci/containers/ubuntu-1804.Dockerfile b/ci/containers/ubuntu-1804.Dockerfile index 3598b01ddcaf..42c4ae400d43 100644 --- a/ci/containers/ubuntu-1804.Dockerfile +++ b/ci/containers/ubuntu-1804.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile ubuntu-1804 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM docker.io/library/ubuntu:18.04 diff --git a/ci/containers/ubuntu-2004.Dockerfile b/ci/containers/ubuntu-2004.Dockerfile index 93edb848df86..e40427c3125e 100644 --- a/ci/containers/ubuntu-2004.Dockerfile +++ b/ci/containers/ubuntu-2004.Dockerfile @@ -2,7 +2,7 @@ # # $ lcitool dockerfile ubuntu-2004 libnbd # -# https://gitlab.com/libvirt/libvirt-ci/-/commit/4a5cf5007ce3bb5e330b9f3361c59... +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... FROM docker.io/library/ubuntu:20.04 -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:07PM +0200, Martin Kletzander wrote:
- removes valgrind from macOS but makes the package installation not fail because of its installation which cannot be done on macOS.
- fixes python update from 3.7 to 3.8 on FreeBSDs and the followup renaming of packages.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- ci/cirrus/freebsd-12.vars | 4 ++-- ci/cirrus/freebsd-13.vars | 4 ++-- ci/cirrus/freebsd-current.vars | 4 ++-- ci/cirrus/macos-11.vars | 4 ++-- ci/containers/centos-8.Dockerfile | 2 +- ci/containers/centos-stream-8.Dockerfile | 2 +- ci/containers/debian-10.Dockerfile | 2 +- ci/containers/debian-sid.Dockerfile | 2 +- ci/containers/fedora-33.Dockerfile | 2 +- ci/containers/fedora-34.Dockerfile | 2 +- ci/containers/fedora-rawhide.Dockerfile | 2 +- ci/containers/opensuse-leap-152.Dockerfile | 2 +- ci/containers/opensuse-tumbleweed.Dockerfile | 2 +- ci/containers/ubuntu-1804.Dockerfile | 2 +- ci/containers/ubuntu-2004.Dockerfile | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-)
ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
It is the favourite small container distribution and it just works. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- .gitlab-ci.yml | 23 +++++++++++ ci/containers/alpine-314.Dockerfile | 57 ++++++++++++++++++++++++++++ ci/containers/alpine-edge.Dockerfile | 57 ++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 ci/containers/alpine-314.Dockerfile create mode 100644 ci/containers/alpine-edge.Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43fba2e84cfa..935711e8fea3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,6 +95,15 @@ stages: - if: "$CIRRUS_GITHUB_REPO && $CIRRUS_API_TOKEN" # Native container build jobs +x64-alpine-314-container: + extends: .container_job + variables: + NAME: alpine-314 + +x64-alpine-edge-container: + extends: .container_job + variables: + NAME: alpine-edge x64-centos-8-container: extends: .container_job @@ -174,6 +183,20 @@ x64-centos-8: variables: NAME: centos-8 +x64-alpine-314: + extends: .native_build_job + needs: + - x64-alpine-314-container + variables: + NAME: alpine-314 + +x64-alpine-edge: + extends: .native_build_job + needs: + - x64-alpine-edge-container + variables: + NAME: alpine-edge + x64-centos-8-clang: extends: .native_build_job needs: diff --git a/ci/containers/alpine-314.Dockerfile b/ci/containers/alpine-314.Dockerfile new file mode 100644 index 000000000000..c9ae76e7120b --- /dev/null +++ b/ci/containers/alpine-314.Dockerfile @@ -0,0 +1,57 @@ +# THIS FILE WAS AUTO-GENERATED +# +# $ lcitool dockerfile alpine-314 libnbd +# +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... + +FROM docker.io/library/alpine:3.14 + +RUN apk update && \ + apk upgrade && \ + apk add \ + autoconf \ + automake \ + bash-completion \ + ca-certificates \ + ccache \ + clang \ + diffutils \ + fuse3 \ + fuse3-dev \ + g++ \ + gcc \ + git \ + glib-dev \ + gnutls-dev \ + gnutls-utils \ + go \ + hexdump \ + iproute2 \ + jq \ + libev-dev \ + libtool \ + libxml2-dev \ + make \ + nbd \ + nbd-client \ + ocaml \ + ocaml-findlib-dev \ + ocaml-ocamldoc \ + perl \ + pkgconf \ + py3-flake8 \ + python3-dev \ + qemu \ + qemu-img \ + sed \ + valgrind && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc + +ENV LANG "en_US.UTF-8" +ENV MAKE "/usr/bin/make" +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" diff --git a/ci/containers/alpine-edge.Dockerfile b/ci/containers/alpine-edge.Dockerfile new file mode 100644 index 000000000000..4512e44252b5 --- /dev/null +++ b/ci/containers/alpine-edge.Dockerfile @@ -0,0 +1,57 @@ +# THIS FILE WAS AUTO-GENERATED +# +# $ lcitool dockerfile alpine-edge libnbd +# +# https://gitlab.com/libvirt/libvirt-ci/-/commit/1b32d74a089da43a0f79eba012ad0... + +FROM docker.io/library/alpine:edge + +RUN apk update && \ + apk upgrade && \ + apk add \ + autoconf \ + automake \ + bash-completion \ + ca-certificates \ + ccache \ + clang \ + diffutils \ + fuse3 \ + fuse3-dev \ + g++ \ + gcc \ + git \ + glib-dev \ + gnutls-dev \ + gnutls-utils \ + go \ + hexdump \ + iproute2 \ + jq \ + libev-dev \ + libtool \ + libxml2-dev \ + make \ + nbd \ + nbd-client \ + ocaml \ + ocaml-findlib-dev \ + ocaml-ocamldoc \ + perl \ + pkgconf \ + py3-flake8 \ + python3-dev \ + qemu \ + qemu-img \ + sed \ + valgrind && \ + mkdir -p /usr/libexec/ccache-wrappers && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \ + ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc + +ENV LANG "en_US.UTF-8" +ENV MAKE "/usr/bin/make" +ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" -- 2.32.0
On Tue, Jul 13, 2021 at 11:26:08PM +0200, Martin Kletzander wrote:
It is the favourite small container distribution and it just works.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> --- .gitlab-ci.yml | 23 +++++++++++ ci/containers/alpine-314.Dockerfile | 57 ++++++++++++++++++++++++++++ ci/containers/alpine-edge.Dockerfile | 57 ++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 ci/containers/alpine-314.Dockerfile create mode 100644 ci/containers/alpine-edge.Dockerfile
ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
On Tue, Jul 13, 2021 at 11:26:02PM +0200, Martin Kletzander wrote:
I hated the fact that it was not finished and it was (is) keeping me awake even though I do not really have tome to do this, but it is finally finished. We can even enable CI notifications to go public if that's something we'd like to do.
Anyway, with this I hope I can finally get libnbd CI out of my mind and hopefully move to CI for other projects ASAP.
Night night ;)
You can see the pipeline passed for this series here: https://gitlab.com/nertpinx/libnbd/-/pipelines/336483317
Martin Kletzander (6): info: Require nbdkit >= 1.14 for info-can.sh One more VSOCK include fix macOS: Simple cloexec/nonblock fix macOS: Do not use --version_script Update CI files CI: Add testing on Alpine
configure.ac | 10 +++ lib/internal.h | 3 + generator/states-connect-socket-activation.c | 2 +- generator/states-connect.c | 11 ++-- lib/uri.c | 2 + lib/utils.c | 68 ++++++++++++++++++++ lib/Makefile.am | 2 +- .gitlab-ci.yml | 23 +++++++ ci/cirrus/freebsd-12.vars | 4 +- ci/cirrus/freebsd-13.vars | 4 +- ci/cirrus/freebsd-current.vars | 4 +- ci/cirrus/macos-11.vars | 4 +- ci/containers/alpine-314.Dockerfile | 57 ++++++++++++++++ ci/containers/alpine-edge.Dockerfile | 57 ++++++++++++++++ ci/containers/centos-8.Dockerfile | 2 +- ci/containers/centos-stream-8.Dockerfile | 2 +- ci/containers/debian-10.Dockerfile | 2 +- ci/containers/debian-sid.Dockerfile | 2 +- ci/containers/fedora-33.Dockerfile | 2 +- ci/containers/fedora-34.Dockerfile | 2 +- ci/containers/fedora-rawhide.Dockerfile | 2 +- ci/containers/opensuse-leap-152.Dockerfile | 2 +- ci/containers/opensuse-tumbleweed.Dockerfile | 2 +- ci/containers/ubuntu-1804.Dockerfile | 2 +- ci/containers/ubuntu-2004.Dockerfile | 2 +- fuzzing/libnbd-fuzz-wrapper.c | 30 ++++++++- fuzzing/libnbd-libfuzzer-test.c | 30 ++++++++- info/info-can.sh | 4 ++ 28 files changed, 309 insertions(+), 28 deletions(-) create mode 100644 ci/containers/alpine-314.Dockerfile create mode 100644 ci/containers/alpine-edge.Dockerfile
-- 2.32.0
participants (3)
-
Eric Blake -
Martin Kletzander -
Richard W.M. Jones