From 86d1fe95296d4eb5ea457a925cc7045074b02ac9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 21 Aug 2019 11:33:20 +0100 Subject: [PATCH] Fix test failure on 32 bit. --- ...-Try-LOGNAME-before-using-getlogin_r.patch | 2 +- ...ly-need-nbdkit-development-headers-N.patch | 96 +++++++++++++++++++ ...ow-in-calculation-on-32-bit-platform.patch | 34 +++++++ libnbd.spec | 11 ++- 4 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 0002-build-Don-t-really-need-nbdkit-development-headers-N.patch create mode 100644 0003-tests-Fix-overflow-in-calculation-on-32-bit-platform.patch diff --git a/0001-lib-Try-LOGNAME-before-using-getlogin_r.patch b/0001-lib-Try-LOGNAME-before-using-getlogin_r.patch index 31c0965..24a0f73 100644 --- a/0001-lib-Try-LOGNAME-before-using-getlogin_r.patch +++ b/0001-lib-Try-LOGNAME-before-using-getlogin_r.patch @@ -1,7 +1,7 @@ From e0b30bceab1cf61d8129b874d0122bc2cccec0e9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 21 Aug 2019 09:57:54 +0100 -Subject: [PATCH] lib: Try $LOGNAME before using getlogin_r. +Subject: [PATCH 1/3] lib: Try $LOGNAME before using getlogin_r. Fixes tests in Koji which failed with nbd_connect_unix: getlogin: No such device or address diff --git a/0002-build-Don-t-really-need-nbdkit-development-headers-N.patch b/0002-build-Don-t-really-need-nbdkit-development-headers-N.patch new file mode 100644 index 0000000..11dc448 --- /dev/null +++ b/0002-build-Don-t-really-need-nbdkit-development-headers-N.patch @@ -0,0 +1,96 @@ +From e3a1f354a45e5e266d6db528900f98b171f4835f Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 21 Aug 2019 10:46:52 +0100 +Subject: [PATCH 2/3] build: Don't really need nbdkit development headers, + NBDKIT_CFLAGS, etc. + +We relied on these in order to test the minimum version of nbdkit, but +didn't use them in any other way. Use another method to check the +minimum version of nbdkit. + +On the other hand we do use a lot more than just nbdkit-sh-plugin, so +test for these. + +Partially reverts commit 8c94da442daa290cc2199b12f0672fed762e3fd5. +--- + README | 4 ++-- + configure.ac | 42 +++++++++++++++++++++++++++--------------- + 2 files changed, 29 insertions(+), 17 deletions(-) + +diff --git a/README b/README +index befbe07..b42ff45 100644 +--- a/README ++++ b/README +@@ -64,8 +64,8 @@ Optional: + * libxml2 is recommended for NBD URI support. If not available then + a few APIs related to URIs will always return error. + +- * The nbdkit command, nbdkit-sh-plugin and nbdkit development headers +- are recommended as they are needed to run the test suite. ++ * The nbdkit command, basic plugins and nbdkit-sh-plugin are ++ recommended as they are needed to run the test suite. + + * nbd-server and qemu-nbd if you want to do interoperability testing + against these servers. +diff --git a/configure.ac b/configure.ac +index fcce1cd..727773e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -137,27 +137,39 @@ AS_IF([test "$with_libxml2" != "no"],[ + ]) + ]) + +-dnl nbdkit, nbdkit-sh-plugin and development headers are only needed +-dnl to run the test suite. ++dnl nbdkit, basic plugins and nbdkit-sh-plugin are only needed to run ++dnl the test suite. ++nbdkit_plugins="memory null pattern sh" ++nbdkit_min_minor="12" ;# 1.12 + AC_CHECK_PROG([NBDKIT], [nbdkit], [nbdkit]) + AS_IF([test "x$NBDKIT" != "x"], [ +- PKG_CHECK_MODULES([NBDKIT], [nbdkit >= 1.12], [ +- AC_SUBST([NBDKIT_CFLAGS]) +- AC_SUBST([NBDKIT_LIBS]) +- have_nbdkit_devel=yes +- ], [ +- AC_MSG_WARN([nbdkit development package is not installed, tests will be disabled]) +- ]) ++ have_nbdkit_features=yes + +- AC_MSG_CHECKING([for nbdkit-sh-plugin]) +- AS_IF([$NBDKIT sh --version >&AS_MESSAGE_LOG_FD 2>&1], [ +- AC_MSG_RESULT([yes]) +- have_nbdkit_sh_plugin=yes ++ AC_MSG_CHECKING([for nbdkit >= 1.$nbdkit_min_minor]) ++ nbdkit_minor="$( ++ $NBDKIT --version | $SED 's/^nbdkit 1\.\(@<:@0-9@:>@*\)\..*/\1/' ++ )" ++ AS_IF([test $nbdkit_minor -ge $nbdkit_min_minor],[ ++ AC_MSG_RESULT([yes (1.$nbdkit_minor)]) + ],[ +- AC_MSG_RESULT([no]) ++ AC_MSG_RESULT([no (1.$nbdkit_minor)]) ++ AC_MSG_WARN([nbdkit is too old, some tests will be disabled]) ++ have_nbdkit_features=no + ]) ++ ++ for p in $nbdkit_plugins; do ++ AC_MSG_CHECKING([for nbdkit $p plugin]) ++ AS_IF([$NBDKIT $p --version >&AS_MESSAGE_LOG_FD 2>&1], [ ++ AC_MSG_RESULT([yes]) ++ ],[ ++ AC_MSG_RESULT([no]) ++ AC_MSG_WARN([nbdkit $p plugin is missing, some tests will be disabled]) ++ have_nbdkit_features=no ++ ]) ++ done + ]) +-AM_CONDITIONAL([HAVE_NBDKIT], [test "x$NBDKIT" != "x" && test "x$have_nbdkit_devel" = "xyes" && test "x$have_nbdkit_sh_plugin" = "xyes"]) ++AM_CONDITIONAL([HAVE_NBDKIT], ++ [test "x$NBDKIT" != "x" && test "x$have_nbdkit_features" = "xyes"]) + + dnl nbd-server and qemu-nbd for interop testing. + AC_CHECK_PROG([NBD_SERVER], [nbd-server], [nbd-server]) +-- +2.22.0 + diff --git a/0003-tests-Fix-overflow-in-calculation-on-32-bit-platform.patch b/0003-tests-Fix-overflow-in-calculation-on-32-bit-platform.patch new file mode 100644 index 0000000..2f69c54 --- /dev/null +++ b/0003-tests-Fix-overflow-in-calculation-on-32-bit-platform.patch @@ -0,0 +1,34 @@ +From 4040499468abb7b04dfed4250ed050916ce4019a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 21 Aug 2019 11:25:20 +0100 +Subject: [PATCH 3/3] tests: Fix overflow in calculation on 32 bit platforms. + +--- + tests/aio-parallel.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/aio-parallel.c b/tests/aio-parallel.c +index ad01da6..d5477c9 100644 +--- a/tests/aio-parallel.c ++++ b/tests/aio-parallel.c +@@ -81,7 +81,7 @@ main (int argc, char *argv[]) + { + pthread_t threads[NR_MULTI_CONN]; + struct thread_status status[NR_MULTI_CONN]; +- size_t i, j; ++ uint64_t i, j; + time_t t; + int err; + unsigned requests, most_in_flight, errors; +@@ -146,7 +146,7 @@ main (int argc, char *argv[]) + exit (EXIT_FAILURE); + } + if (status[i].status != 0) { +- fprintf (stderr, "thread %zu failed with status %d\n", ++ fprintf (stderr, "thread %" PRIu64 " failed with status %d\n", + i, status[i].status); + errors++; + } +-- +2.22.0 + diff --git a/libnbd.spec b/libnbd.spec index a52b9a3..f38159e 100644 --- a/libnbd.spec +++ b/libnbd.spec @@ -2,7 +2,7 @@ %global verify_tarball_signature 1 # If there are patches which touch autotools files, set this to 1. -%global patches_touch_autotools %{nil} +%global patches_touch_autotools 1 # The source directory. %global source_directory 0.x-unstable-api @@ -22,7 +22,9 @@ Source1: http://libguestfs.org/download/libnbd/%{source_directory}/%{name # https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex Source2: libguestfs.keyring -Patch1: 0001-lib-Try-LOGNAME-before-using-getlogin_r.patch +Patch0001: 0001-lib-Try-LOGNAME-before-using-getlogin_r.patch +Patch0002: 0002-build-Don-t-really-need-nbdkit-development-headers-N.patch +Patch0003: 0003-tests-Fix-overflow-in-calculation-on-32-bit-platform.patch %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool @@ -51,8 +53,10 @@ BuildRequires: glib2-devel # Only for running the test suite. BuildRequires: gnutls-utils BuildRequires: nbdkit +BuildRequires: nbdkit-memory-plugin +BuildRequires: nbdkit-null-plugin +BuildRequires: nbdkit-pattern-plugin BuildRequires: nbdkit-sh-plugin -BuildRequires: nbdkit-devel BuildRequires: nbd BuildRequires: qemu-img BuildRequires: gcc-c++ @@ -222,6 +226,7 @@ make %{?_smp_mflags} check || { - Add glib2-devel BR so we build the glib main loop example. - Add upstream patch to fix test error: nbd_connect_unix: getlogin: No such device or address +- Fix test failure on 32 bit. * Tue Aug 20 2019 Richard W.M. Jones - 0.9.8-3 - Bump and rebuild to fix releng brokenness.