Rebase to new stable branch version 1.30.7
resolves: rhbz#2059289
This commit is contained in:
parent
74f0e13c8d
commit
82a691cb64
@ -1,28 +0,0 @@
|
||||
From e5ddfa73e84495c6cba5410e414814c89e5616bb Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 14 Jun 2022 10:53:26 +0100
|
||||
Subject: [PATCH] docs/nbdkit-protocol.pod: block size support was added in
|
||||
1.30
|
||||
|
||||
Fixes: commit 366c41f86f2846c742d0c42f110b70969fe3bf95
|
||||
(cherry picked from commit 9cc1e15014fc9565fd8169f56e4e91cbc9e585e4)
|
||||
---
|
||||
docs/nbdkit-protocol.pod | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/nbdkit-protocol.pod b/docs/nbdkit-protocol.pod
|
||||
index 39ba021c..1baa1819 100644
|
||||
--- a/docs/nbdkit-protocol.pod
|
||||
+++ b/docs/nbdkit-protocol.pod
|
||||
@@ -212,7 +212,7 @@ a client more details about the export.
|
||||
|
||||
=item C<NBD_INFO_BLOCK_SIZE>
|
||||
|
||||
-I<Not supported>.
|
||||
+Supported in nbdkit E<ge> 1.30.
|
||||
|
||||
=item Resize Extension
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From d64bfe6d0ceec79ef9979b58a9e3bd179c91ba52 Mon Sep 17 00:00:00 2001
|
||||
From 9f9f1edb5a93574bf717e2d884a30a87b231a572 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 15 Apr 2022 12:08:37 +0100
|
||||
Subject: [PATCH] ssh: Allow the remote file to be created
|
@ -1,50 +0,0 @@
|
||||
From 3c00f00e5c42633b25f2d54f852af9332bf6c3b7 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 19 Jun 2022 17:58:11 +0100
|
||||
Subject: [PATCH] perl: Move GCC diagnostic ignored earlier
|
||||
|
||||
Since updating to perl 5.36, the -Wshadow warn/error now occurs when
|
||||
including the <perl.h> header file, rather than later on when a macro
|
||||
is used. Because the GCC diagnostic ignored line appeared after
|
||||
<perl.h> was included it had no effect. Moving it before the
|
||||
inclusion works around this. The error was:
|
||||
|
||||
In file included from /usr/lib64/perl5/CORE/perl.h:4155,
|
||||
from perl.c:47:
|
||||
/usr/lib64/perl5/CORE/sv_inline.h: In function 'Perl_newSV_type':
|
||||
/usr/lib64/perl5/CORE/handy.h:97:35: error: declaration of 'p_' shadows a previous local [-Werror=shadow]
|
||||
97 | # define MUTABLE_PTR(p) ({ void *p_ = (p); p_; })
|
||||
| ^~
|
||||
|
||||
(cherry picked from commit 754f1d46d14b8c97133885fb1422697177e40722)
|
||||
---
|
||||
plugins/perl/perl.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c
|
||||
index 386d5052..26de0e54 100644
|
||||
--- a/plugins/perl/perl.c
|
||||
+++ b/plugins/perl/perl.c
|
||||
@@ -42,6 +42,9 @@
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
+/* perl.h contains multiple variable shadowing */
|
||||
+#pragma GCC diagnostic ignored "-Wshadow"
|
||||
+
|
||||
#include <XSUB.h>
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
@@ -51,9 +54,6 @@
|
||||
|
||||
#include "cleanup.h"
|
||||
|
||||
-/* Use of perl.h insists on shadowing my_perl during XS(). */
|
||||
-#pragma GCC diagnostic ignored "-Wshadow"
|
||||
-
|
||||
static PerlInterpreter *my_perl;
|
||||
static const char *script;
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 8dc8ecf751d6cca27ee08f58abb6faac3a3cda94 Mon Sep 17 00:00:00 2001
|
||||
From c9c5a1455096822264df02cc157a693310144a62 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 16 Apr 2022 18:39:13 +0100
|
||||
Subject: [PATCH] readahead: Rewrite this filter so it prefetches using .cache
|
@ -1,55 +0,0 @@
|
||||
From 661994028581a397336aee4b7a846c9b1d0e4b0e Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 19 Jun 2022 18:13:34 +0100
|
||||
Subject: [PATCH] ocaml: Add valgrind suppression for OCaml 4.14 bug
|
||||
|
||||
==3869068== Memcheck, a memory error detector
|
||||
==3869068== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
|
||||
==3869068== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
|
||||
==3869068== Command: ./test_010_import.opt
|
||||
==3869068==
|
||||
==3869068== Syscall param sigaltstack(ss) points to uninitialised byte(s)
|
||||
==3869068== at 0x49DF24B: sigaltstack (syscall-template.S:120)
|
||||
==3869068== by 0x1A1365: caml_terminate_signals (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== by 0x1C0C33: caml_startup_common (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== by 0x1C0CAE: caml_main (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== by 0x15CDC1: main (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== Address 0x1ffeffe500 is on thread 1's stack
|
||||
==3869068== in frame #1, created by caml_terminate_signals (???:)
|
||||
==3869068==
|
||||
==3869068== Syscall param sigaltstack(ss) points to uninitialised byte(s)
|
||||
==3869068== at 0x49DF24B: sigaltstack (syscall-template.S:120)
|
||||
==3869068== by 0x1A1365: caml_terminate_signals (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== by 0x1B1B6F: caml_do_exit (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== by 0x15CDC8: main (in /home/rjones/d/libnbd/ocaml/tests/test_010_import.opt)
|
||||
==3869068== Address 0x1ffeffe4d0 is on thread 1's stack
|
||||
==3869068== in frame #1, created by caml_terminate_signals (???:)
|
||||
|
||||
(cherry picked from libnbd commit 73dec295f3bbdf8afbfd548eb5a776dee27b0ac0)
|
||||
|
||||
(cherry picked from commit e586ca637dfb7d2b4629248cb067a980ccf324f3)
|
||||
---
|
||||
valgrind/ocaml.suppressions | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/valgrind/ocaml.suppressions b/valgrind/ocaml.suppressions
|
||||
index 8bafc885..fd289c51 100644
|
||||
--- a/valgrind/ocaml.suppressions
|
||||
+++ b/valgrind/ocaml.suppressions
|
||||
@@ -46,3 +46,13 @@
|
||||
...
|
||||
fun:caml_setup_stack_overflow_detection
|
||||
}
|
||||
+
|
||||
+# Potential bug in OCaml 4.14
|
||||
+# https://github.com/ocaml/ocaml/issues/11335
|
||||
+{
|
||||
+ caml_terminate_signals_uninitialized_sigaltstack
|
||||
+ Memcheck:Param
|
||||
+ sigaltstack(ss)
|
||||
+ fun:sigaltstack
|
||||
+ fun:caml_terminate_signals
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 3a52ccb52f6d6e2d1539a05981158fccfa23f2bd Mon Sep 17 00:00:00 2001
|
||||
From ce5607d2bf2f895464d0cb2ba9c285c67325e7f5 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 21 Apr 2022 16:14:46 +0100
|
||||
Subject: [PATCH] readahead: Fix test
|
@ -1,4 +1,4 @@
|
||||
From 4fa66fba6699f8f2165b379979f59ab53c8b27bb Mon Sep 17 00:00:00 2001
|
||||
From f69d0db070ee3a02351c3c4ada0ab00c33bc76ef Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 30 Apr 2022 12:35:07 +0100
|
||||
Subject: [PATCH] New filter: luks
|
||||
@ -9,7 +9,7 @@ compatible with the ones used by dm-crypt and qemu.
|
||||
(cherry picked from commit 468919dce6c5eb57503eacac0f67e5dd87c58e6c)
|
||||
---
|
||||
TODO | 11 +-
|
||||
configure.ac | 7 +-
|
||||
configure.ac | 6 +-
|
||||
docs/nbdkit-tls.pod | 1 +
|
||||
filters/luks/Makefile.am | 77 ++
|
||||
filters/luks/luks.c | 1263 +++++++++++++++++++++++++++
|
||||
@ -18,7 +18,7 @@ compatible with the ones used by dm-crypt and qemu.
|
||||
tests/Makefile.am | 12 +
|
||||
tests/test-luks-copy.sh | 125 +++
|
||||
tests/test-luks-info.sh | 56 ++
|
||||
10 files changed, 1669 insertions(+), 4 deletions(-)
|
||||
10 files changed, 1668 insertions(+), 4 deletions(-)
|
||||
create mode 100644 filters/luks/Makefile.am
|
||||
create mode 100644 filters/luks/luks.c
|
||||
create mode 100644 filters/luks/nbdkit-luks-filter.pod
|
||||
@ -55,7 +55,7 @@ index 4d2a9796..0f5dc41d 100644
|
||||
|
||||
* The filter should open a new connection to the plugin per background
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 6b446a03..f054a9ac 100644
|
||||
index 10729d8a..78af16d5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -127,6 +127,7 @@ filters="\
|
||||
@ -77,7 +77,7 @@ index 6b446a03..f054a9ac 100644
|
||||
AC_MSG_CHECKING([for default TLS session priority string])
|
||||
AC_ARG_WITH([tls-priority],
|
||||
[AS_HELP_STRING([--with-tls-priority],
|
||||
@@ -1380,6 +1382,7 @@ AC_CONFIG_FILES([Makefile
|
||||
@@ -1383,6 +1385,7 @@ AC_CONFIG_FILES([Makefile
|
||||
filters/ip/Makefile
|
||||
filters/limit/Makefile
|
||||
filters/log/Makefile
|
||||
@ -85,15 +85,14 @@ index 6b446a03..f054a9ac 100644
|
||||
filters/multi-conn/Makefile
|
||||
filters/nocache/Makefile
|
||||
filters/noextents/Makefile
|
||||
@@ -1496,6 +1499,8 @@ feature "ext2 ................................... " \
|
||||
test "x$HAVE_EXT2_TRUE" = "x"
|
||||
feature "gzip ................................... " \
|
||||
test "x$HAVE_ZLIB_TRUE" = "x"
|
||||
+feature "LUKS ................................... " \
|
||||
+ test "x$HAVE_GNUTLS_TRUE" != "x"
|
||||
feature "xz ..................................... " \
|
||||
test "x$HAVE_LIBLZMA_TRUE" = "x"
|
||||
@@ -1481,6 +1484,7 @@ echo "Optional filters:"
|
||||
echo
|
||||
feature "ext2" test "x$HAVE_EXT2_TRUE" = "x"
|
||||
feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x"
|
||||
+feature "LUKS" test "x$HAVE_GNUTLS_TRUE" != "x"
|
||||
feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x"
|
||||
|
||||
echo
|
||||
diff --git a/docs/nbdkit-tls.pod b/docs/nbdkit-tls.pod
|
||||
index 86f5f984..4d0dc14c 100644
|
||||
--- a/docs/nbdkit-tls.pod
|
@ -1,53 +0,0 @@
|
||||
From c92e0b0f2881b385f3183746039cf91a6d1821f9 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 20 Jun 2022 20:24:27 +0100
|
||||
Subject: [PATCH] ocaml: Add further valgrind suppression
|
||||
|
||||
After discussion with the OCaml team we think these are both bugs in
|
||||
valgrind, not OCaml, but we still need a suppression.
|
||||
|
||||
==4145632== Syscall param sigaltstack(ss) points to uninitialised byte(s)
|
||||
==4145632== at 0xCC5E24B: sigaltstack (syscall-template.S:120)
|
||||
==4145632== by 0xD7F46CC: caml_stop_stack_overflow_detection (in /home/rjones/d/nbdkit/tests/test-ocaml-plugin.so)
|
||||
==4145632== by 0xD7F277E: caml_startup_common (in /home/rjones/d/nbdkit/tests/test-ocaml-plugin.so)
|
||||
==4145632== by 0xD7F27CC: caml_startup (in /home/rjones/d/nbdkit/tests/test-ocaml-plugin.so)
|
||||
==4145632== by 0xC986891: constructor (plugin.c:64)
|
||||
==4145632== by 0xC133CED: call_init (dl-init.c:70)
|
||||
==4145632== by 0xC133DDB: _dl_init (dl-init.c:117)
|
||||
==4145632== by 0xCD72A73: _dl_catch_exception (dl-error-skeleton.c:182)
|
||||
==4145632== by 0xC13A955: dl_open_worker (dl-open.c:808)
|
||||
==4145632== by 0xCD72A1D: _dl_catch_exception (dl-error-skeleton.c:208)
|
||||
==4145632== by 0xC13ACEB: _dl_open (dl-open.c:883)
|
||||
==4145632== by 0xCCA7EC9: dlopen_doit (dlopen.c:56)
|
||||
==4145632== by 0xCD72A1D: _dl_catch_exception (dl-error-skeleton.c:208)
|
||||
==4145632== by 0xCD72AD2: _dl_catch_error (dl-error-skeleton.c:227)
|
||||
==4145632== by 0xCCA79DE: _dlerror_run (dlerror.c:138)
|
||||
==4145632== by 0xCCA7F67: dlopen@@GLIBC_2.34 (dlopen.c:71)
|
||||
==4145632== by 0x10F775: main (main.c:833)
|
||||
==4145632== Address 0x1ffeffaca0 is on thread 1's stack
|
||||
==4145632== in frame #1, created by caml_stop_stack_overflow_detection (???:)
|
||||
|
||||
(cherry picked from commit dba71bf2be6dbcc1585f36a6779395c9fe2cc49d)
|
||||
---
|
||||
valgrind/ocaml.suppressions | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/valgrind/ocaml.suppressions b/valgrind/ocaml.suppressions
|
||||
index fd289c51..1e5e9505 100644
|
||||
--- a/valgrind/ocaml.suppressions
|
||||
+++ b/valgrind/ocaml.suppressions
|
||||
@@ -56,3 +56,11 @@
|
||||
fun:sigaltstack
|
||||
fun:caml_terminate_signals
|
||||
}
|
||||
+
|
||||
+{
|
||||
+ caml_stop_stack_overflow_detection_uninitialized_sigaltstack
|
||||
+ Memcheck:Param
|
||||
+ sigaltstack(ss)
|
||||
+ fun:sigaltstack
|
||||
+ fun:caml_stop_stack_overflow_detection
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 2217ff117f800cecd6172b01a6833bd6398ebbc3 Mon Sep 17 00:00:00 2001
|
||||
From cc0bc042e260334b7f5b39ea4c283c9ad9bac164 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 8 May 2022 12:13:39 +0100
|
||||
Subject: [PATCH] luks: Disable filter with old GnuTLS in Debian 10
|
||||
@ -30,13 +30,13 @@ filter work on this platform so it's best to compile it out.
|
||||
Fixes: commit 468919dce6c5eb57503eacac0f67e5dd87c58e6c
|
||||
(cherry picked from commit f9f67e483f4aad19ad6101163d32562f13504ca7)
|
||||
---
|
||||
configure.ac | 7 +++++--
|
||||
configure.ac | 5 ++++-
|
||||
filters/luks/Makefile.am | 2 +-
|
||||
tests/Makefile.am | 2 +-
|
||||
3 files changed, 7 insertions(+), 4 deletions(-)
|
||||
3 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f054a9ac..d0c765af 100644
|
||||
index 78af16d5..7089f937 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -636,12 +636,15 @@ AS_IF([test "x$GNUTLS_LIBS" != "x"],[
|
||||
@ -55,17 +55,15 @@ index f054a9ac..d0c765af 100644
|
||||
|
||||
AC_ARG_ENABLE([linuxdisk],
|
||||
[AS_HELP_STRING([--disable-linuxdisk],
|
||||
@@ -1499,8 +1502,8 @@ feature "ext2 ................................... " \
|
||||
test "x$HAVE_EXT2_TRUE" = "x"
|
||||
feature "gzip ................................... " \
|
||||
test "x$HAVE_ZLIB_TRUE" = "x"
|
||||
-feature "LUKS ................................... " \
|
||||
- test "x$HAVE_GNUTLS_TRUE" != "x"
|
||||
+feature "luks ................................... " \
|
||||
+ test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x"
|
||||
feature "xz ..................................... " \
|
||||
test "x$HAVE_LIBLZMA_TRUE" = "x"
|
||||
@@ -1484,7 +1487,7 @@ echo "Optional filters:"
|
||||
echo
|
||||
feature "ext2" test "x$HAVE_EXT2_TRUE" = "x"
|
||||
feature "gzip" test "x$HAVE_ZLIB_TRUE" = "x"
|
||||
-feature "LUKS" test "x$HAVE_GNUTLS_TRUE" != "x"
|
||||
+feature "luks" test "x$HAVE_GNUTLS_PBKDF2_TRUE" = "x"
|
||||
feature "xz" test "x$HAVE_LIBLZMA_TRUE" = "x"
|
||||
|
||||
echo
|
||||
diff --git a/filters/luks/Makefile.am b/filters/luks/Makefile.am
|
||||
index 30089621..622e5c3d 100644
|
||||
--- a/filters/luks/Makefile.am
|
@ -1,30 +0,0 @@
|
||||
From 97e037a3abb0e5b4d8d78b8bcc810fd77803af12 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 21 Jun 2022 12:21:55 +0100
|
||||
Subject: [PATCH] valgrind: Update comment about valgrind bug affecting OCaml
|
||||
|
||||
Fixes: e586ca637d ("ocaml: Add valgrind suppression for OCaml 4.14 bug")
|
||||
Fixes: dba71bf2be ("ocaml: Add further valgrind suppression")
|
||||
(cherry picked from commit 6f1584ca76979f4e5da912c9d36fbd12ab18d8e2)
|
||||
---
|
||||
valgrind/ocaml.suppressions | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/valgrind/ocaml.suppressions b/valgrind/ocaml.suppressions
|
||||
index 1e5e9505..f2245431 100644
|
||||
--- a/valgrind/ocaml.suppressions
|
||||
+++ b/valgrind/ocaml.suppressions
|
||||
@@ -47,8 +47,8 @@
|
||||
fun:caml_setup_stack_overflow_detection
|
||||
}
|
||||
|
||||
-# Potential bug in OCaml 4.14
|
||||
-# https://github.com/ocaml/ocaml/issues/11335
|
||||
+# Valgrind bug affecting OCaml 4.14
|
||||
+# https://bugs.kde.org/show_bug.cgi?id=455711
|
||||
{
|
||||
caml_terminate_signals_uninitialized_sigaltstack
|
||||
Memcheck:Param
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From 015c1abe341484a61afe31b765c4d8d2fece0fe6 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 25 Jun 2022 16:35:22 +0100
|
||||
Subject: [PATCH] exitwhen: Check nbdkit doesn't exit before the pipe is closed
|
||||
|
||||
Enhance the existing test with a check that nbdkit does not exit
|
||||
before the pipe is closed.
|
||||
|
||||
(cherry picked from commit 278b95f931044bd9f2aeb316ccfa00308beacc8d)
|
||||
---
|
||||
tests/test-exitwhen-pipe-closed.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/test-exitwhen-pipe-closed.c b/tests/test-exitwhen-pipe-closed.c
|
||||
index 50f28bde..8949932e 100644
|
||||
--- a/tests/test-exitwhen-pipe-closed.c
|
||||
+++ b/tests/test-exitwhen-pipe-closed.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <signal.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
@@ -74,13 +75,23 @@ main (int argc, char *argv[])
|
||||
perror ("execvp");
|
||||
_exit (EXIT_FAILURE);
|
||||
}
|
||||
+ free (param);
|
||||
|
||||
- /* Close the read side of the pipe. */
|
||||
+ /* Close the read side of the pipe (this does NOT cause nbdkit to exit). */
|
||||
close (fd[0]);
|
||||
|
||||
+ /* Wait a bit. */
|
||||
+ sleep (2);
|
||||
+
|
||||
+ /* nbdkit should still be running. */
|
||||
+ if (kill (pid, 0) != 0) {
|
||||
+ fprintf (stderr, "FAIL: %s: nbdkit exited before pipe was closed\n",
|
||||
+ argv[0]);
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
/* The test here is simply that nbdkit exits because we exit and our
|
||||
* side of the pipe is closed.
|
||||
*/
|
||||
- free (param);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From fc8d93e08ff1798d6582a21d517557af4bcb79d9 Mon Sep 17 00:00:00 2001
|
||||
From 9961cd8018d6287af45d7691656c56d9443660cf Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 8 May 2022 12:30:09 +0100
|
||||
Subject: [PATCH] luks: Various fixes for Clang
|
@ -1,4 +1,4 @@
|
||||
From b6adfa1cef107c0adb06d280003b2b93f751e068 Mon Sep 17 00:00:00 2001
|
||||
From 24963801a0a0a4eb1c33d2cfa213e0564fef889c Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 8 May 2022 12:38:00 +0100
|
||||
Subject: [PATCH] luks: Link with libcompat on Windows
|
@ -1,77 +0,0 @@
|
||||
From 26e0163cb890ab688943fa8134b523bd6b6eae04 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 10:41:04 +0100
|
||||
Subject: [PATCH] server: Display kTLS setting in debug output
|
||||
|
||||
When using -D nbdkit.tls.session=1 display the kTLS
|
||||
(kernel-accelerated TLS) setting in the debug output.
|
||||
|
||||
Thanks: Daiki Ueno
|
||||
(cherry picked from commit fd626688845324a4b3c387fa901d96e5d20ea634)
|
||||
---
|
||||
configure.ac | 1 +
|
||||
server/crypto.c | 22 ++++++++++++++++++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d958ff2c..6b446a03 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -636,6 +636,7 @@ AS_IF([test "$GNUTLS_LIBS" != ""],[
|
||||
gnutls_group_get_name \
|
||||
gnutls_session_set_verify_cert \
|
||||
gnutls_srp_server_get_username \
|
||||
+ gnutls_transport_is_ktls_enabled \
|
||||
])
|
||||
LIBS="$old_LIBS"
|
||||
])
|
||||
diff --git a/server/crypto.c b/server/crypto.c
|
||||
index df64e784..51a83b4d 100644
|
||||
--- a/server/crypto.c
|
||||
+++ b/server/crypto.c
|
||||
@@ -53,6 +53,7 @@
|
||||
#ifdef HAVE_GNUTLS
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
+#include <gnutls/socket.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
static int crypto_auth;
|
||||
@@ -531,6 +532,9 @@ debug_session (gnutls_session_t session)
|
||||
bool dhe = false, ecdh = false;
|
||||
int grp;
|
||||
const char *desc, *username, *hint;
|
||||
+#ifdef HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED
|
||||
+ gnutls_transport_ktls_enable_flags_t ktls_enabled;
|
||||
+#endif
|
||||
|
||||
if (nbdkit_debug_tls_session <= 0)
|
||||
return;
|
||||
@@ -538,6 +542,24 @@ debug_session (gnutls_session_t session)
|
||||
desc = gnutls_session_get_desc (session);
|
||||
if (desc) nbdkit_debug ("TLS session: %s", desc);
|
||||
|
||||
+#ifdef HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED
|
||||
+ ktls_enabled = gnutls_transport_is_ktls_enabled (session);
|
||||
+ switch (ktls_enabled) {
|
||||
+ case GNUTLS_KTLS_RECV:
|
||||
+ nbdkit_debug ("TLS: kTLS enabled for receive only"); break;
|
||||
+ case GNUTLS_KTLS_SEND:
|
||||
+ nbdkit_debug ("TLS: kTLS enabled for send only"); break;
|
||||
+ case GNUTLS_KTLS_DUPLEX:
|
||||
+ nbdkit_debug ("TLS: kTLS enabled full duplex"); break;
|
||||
+ default:
|
||||
+ if ((int) ktls_enabled == 0)
|
||||
+ nbdkit_debug ("TLS: kTLS disabled");
|
||||
+ else
|
||||
+ nbdkit_debug ("TLS: kTLS enabled unknown setting: %d",
|
||||
+ (int) ktls_enabled);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
kx = gnutls_kx_get (session);
|
||||
cred = gnutls_auth_get_type (session);
|
||||
switch (cred) {
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From b37b8670455b28b0c337e550137ff562177a8769 Mon Sep 17 00:00:00 2001
|
||||
From 22b56fee6d3ed2a5ea37f9b1ed62b9d5144e5369 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 8 May 2022 16:13:13 +0100
|
||||
Subject: [PATCH] luks: Refactor the filter
|
@ -1,46 +0,0 @@
|
||||
From a009e5456582c17d537e63b34fecca99a2d58867 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 11:59:57 +0100
|
||||
Subject: [PATCH] server: Work around incorrect include in gnutls/socket.h
|
||||
|
||||
On MinGW:
|
||||
|
||||
In file included from crypto.c:56:
|
||||
/usr/x86_64-w64-mingw32/sys-root/mingw/include/gnutls/socket.h:32:10: fatal error: sys/socket.h: No such file or directory
|
||||
32 | #include <sys/socket.h>
|
||||
| ^~~~~~~~~~~~~~
|
||||
|
||||
gnutls/socket.h shouldn't include this header on MinGW. As a
|
||||
workaround until this is fixed, only include the header when we know
|
||||
that the function we need is available.
|
||||
|
||||
We will need to revisit this fix when gnutls is fixed.
|
||||
|
||||
Link: https://gitlab.com/gnutls/gnutls/-/issues/1382
|
||||
Updates: commit fd626688845324a4b3c387fa901d96e5d20ea634
|
||||
(cherry picked from commit efc6e3e9b8448ae9530ffab3e95adf072ff02adf)
|
||||
---
|
||||
server/crypto.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/server/crypto.c b/server/crypto.c
|
||||
index 51a83b4d..06c719f5 100644
|
||||
--- a/server/crypto.c
|
||||
+++ b/server/crypto.c
|
||||
@@ -53,9 +53,12 @@
|
||||
#ifdef HAVE_GNUTLS
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
-#include <gnutls/socket.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
+#ifdef HAVE_GNUTLS_TRANSPORT_IS_KTLS_ENABLED
|
||||
+#include <gnutls/socket.h>
|
||||
+#endif
|
||||
+
|
||||
static int crypto_auth;
|
||||
#define CRYPTO_AUTH_CERTIFICATES 1
|
||||
#define CRYPTO_AUTH_PSK 2
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From ec35192381c45b8fdb954bd2eb10bba304f8dcca Mon Sep 17 00:00:00 2001
|
||||
From b3989481c7c605f1872ac15d42cf6a9ac738ab00 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 8 May 2022 18:05:45 +0100
|
||||
Subject: [PATCH] tests: luks: Reduce time taken to run these tests
|
@ -1,72 +0,0 @@
|
||||
From 660a2d164d27f6a563731172439a39a284a2e674 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 14:01:51 +0100
|
||||
Subject: [PATCH] tests/test-parallel-sh.sh: Small cleanups
|
||||
|
||||
Quote the inline script to make it easier to follow. This requires us
|
||||
to export $curr_fds to nbdkit, but that's fine.
|
||||
|
||||
Use $curr_fds != "" as a proxy for the existence of /proc/$$/fd so we
|
||||
don't need to test that twice.
|
||||
|
||||
Print the parent /proc/$$/fd as well as the child, so if a leaked fd
|
||||
happens it's easier to tell what it is.
|
||||
|
||||
These are just refactorings which should not affect the test.
|
||||
|
||||
(cherry picked from commit 053293f93acee196e6411baf6f2b8827069ae7bf)
|
||||
---
|
||||
tests/test-parallel-sh.sh | 22 +++++++++++++---------
|
||||
1 file changed, 13 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/tests/test-parallel-sh.sh b/tests/test-parallel-sh.sh
|
||||
index 39ccd569..04f58b89 100755
|
||||
--- a/tests/test-parallel-sh.sh
|
||||
+++ b/tests/test-parallel-sh.sh
|
||||
@@ -65,30 +65,34 @@ timeout 30s </dev/null qemu-io -f raw -c "aio_write -P 1 0 512" \
|
||||
|
||||
curr_fds=
|
||||
if test -d /proc/$$/fd; then
|
||||
+ echo "parent fds:" >&2
|
||||
+ ls -l /proc/$$/fd >&2
|
||||
curr_fds=$(/usr/bin/env bash -c '(ls /proc/$$/fd)' | wc -w)
|
||||
fi
|
||||
+export curr_fds
|
||||
echo "using curr_fds=$curr_fds"
|
||||
|
||||
-cat > test-parallel-sh.script <<EOF
|
||||
+cat > test-parallel-sh.script <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
f=test-parallel-sh.data
|
||||
-if ! test -f \$f; then
|
||||
+if ! test -f $f; then
|
||||
echo "can't locate test-parallel-sh.data" >&2; exit 5
|
||||
fi
|
||||
-if test -d /proc/\$\$/fd; then
|
||||
+if test -n "$curr_fds"; then
|
||||
(
|
||||
- if test \$( ls /proc/\$\$/fd | wc -w ) -ne \$(($curr_fds + 1)); then
|
||||
+ if test $( ls /proc/$$/fd | wc -w ) -ne $(($curr_fds + 1)); then
|
||||
+ echo "nbdkit script fds:" >&2
|
||||
+ ls -l /proc/$$/fd >&2
|
||||
echo "there seem to be leaked fds, curr_fds=$curr_fds" >&2
|
||||
- ls -l /proc/\$\$/fd >&2
|
||||
exit 1
|
||||
fi
|
||||
) || exit 5
|
||||
fi
|
||||
-case \$1 in
|
||||
+case $1 in
|
||||
thread_model) echo parallel ;;
|
||||
- get_size) stat -L -c %s \$f || exit 1 ;;
|
||||
- pread) dd iflag=skip_bytes,count_bytes skip=\$4 count=\$3 if=\$f || exit 1 ;;
|
||||
- pwrite) dd oflag=seek_bytes conv=notrunc seek=\$4 of=\$f || exit 1 ;;
|
||||
+ get_size) stat -L -c %s $f || exit 1 ;;
|
||||
+ pread) dd iflag=skip_bytes,count_bytes skip=$4 count=$3 if=$f || exit 1 ;;
|
||||
+ pwrite) dd oflag=seek_bytes conv=notrunc seek=$4 of=$f || exit 1 ;;
|
||||
can_write) ;;
|
||||
*) exit 2 ;;
|
||||
esac
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From ae9a67597a3a4e4a2df93d655265902ec41a189b Mon Sep 17 00:00:00 2001
|
||||
From 509c71f425945e219ceb507f06bbac546fb26c7c Mon Sep 17 00:00:00 2001
|
||||
From: Nikolaus Rath <Nikolaus@rath.org>
|
||||
Date: Mon, 9 May 2022 10:04:30 +0100
|
||||
Subject: [PATCH] Add nbdkit.parse_size() Python function.
|
@ -1,32 +0,0 @@
|
||||
From 1452ea5da99ce2ad0f1758e656f4de4f78199091 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Mon, 27 Jun 2022 14:16:12 +0100
|
||||
Subject: [PATCH] tests/test-parallel-sh.sh: Skip test under valgrind +
|
||||
debuginfod
|
||||
|
||||
(cherry picked from commit ec44059fbbb32c6fb809a96d80e3e0dedf607794)
|
||||
---
|
||||
tests/test-parallel-sh.sh | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/tests/test-parallel-sh.sh b/tests/test-parallel-sh.sh
|
||||
index 04f58b89..d2c42305 100755
|
||||
--- a/tests/test-parallel-sh.sh
|
||||
+++ b/tests/test-parallel-sh.sh
|
||||
@@ -41,6 +41,13 @@ requires dd iflag=count_bytes </dev/null
|
||||
nbdkit --dump-plugin sh | grep -q ^thread_model=parallel ||
|
||||
{ echo "nbdkit lacks support for parallel requests"; exit 77; }
|
||||
|
||||
+# debuginfod breaks valgrinding of this test because it creates about
|
||||
+# a dozen pipe file descriptors, which breaks the leaked fd
|
||||
+# assumptions in the test below.
|
||||
+if [ "$NBDKIT_VALGRIND" = "1" ]; then
|
||||
+ requires test -z "$DEBUGINFOD_URLS"
|
||||
+fi
|
||||
+
|
||||
cleanup_fn rm -f test-parallel-sh.data test-parallel-sh.out test-parallel-sh.script
|
||||
|
||||
# Populate file, and sanity check that qemu-io can issue parallel requests
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 0e71fee19dc2b239cb11f4d879a3276feca48f58 Mon Sep 17 00:00:00 2001
|
||||
From cf7bb8134726263b8f0f1dc0478ca82cdc22dbd4 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 13:47:19 +0100
|
||||
Subject: [PATCH] cache: Fix cross-reference nbdkit-readahead-filter
|
@ -1,302 +0,0 @@
|
||||
From 06d47e2efe1387a3873529c52a4c7c680ddeee22 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 7 Jul 2022 12:37:10 +0100
|
||||
Subject: [PATCH] common/include: Add ARRAY_SIZE macro
|
||||
|
||||
This macro returns the length (in elements) at compile time of arrays
|
||||
declared as:
|
||||
|
||||
int foo[] = { 1, 2, 3 };
|
||||
|
||||
ARRAY_SIZE(foo)
|
||||
===> 3
|
||||
|
||||
It also attempts to detect some errors, such as using the macro with a
|
||||
pointer instead of an array, with some ideas borrowed (not copied)
|
||||
from Linux, QEMU and Stack Overflow questions.
|
||||
|
||||
Link: https://stackoverflow.com/questions/19452971/array-size-macro-that-rejects-pointers
|
||||
Link: https://listman.redhat.com/archives/libguestfs/2022-July/029412.html
|
||||
Thanks: Laszlo Ersek
|
||||
(cherry picked from commit 0fa23df5cd5dc97a55857416ea81d5de6d867c18)
|
||||
---
|
||||
.gitignore | 1 +
|
||||
common/include/Makefile.am | 7 +++
|
||||
common/include/array-size.h | 41 +++++++++++++
|
||||
common/include/compiler-macros.h | 60 +++++++++++++++++++
|
||||
common/include/test-array-size.c | 100 +++++++++++++++++++++++++++++++
|
||||
5 files changed, 209 insertions(+)
|
||||
create mode 100644 common/include/array-size.h
|
||||
create mode 100644 common/include/compiler-macros.h
|
||||
create mode 100644 common/include/test-array-size.c
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 10e1f99d..658fd4e6 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -35,6 +35,7 @@ plugins/*/*.3
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/common/bitmap/test-bitmap
|
||||
+/common/include/test-array-size
|
||||
/common/include/test-ascii-ctype
|
||||
/common/include/test-ascii-string
|
||||
/common/include/test-byte-swapping
|
||||
diff --git a/common/include/Makefile.am b/common/include/Makefile.am
|
||||
index b73dd471..d3cf9408 100644
|
||||
--- a/common/include/Makefile.am
|
||||
+++ b/common/include/Makefile.am
|
||||
@@ -34,10 +34,12 @@ include $(top_srcdir)/common-rules.mk
|
||||
# These headers contain only common code shared by the core server,
|
||||
# plugins and/or filters. They are not installed.
|
||||
EXTRA_DIST = \
|
||||
+ array-size.h \
|
||||
ascii-ctype.h \
|
||||
ascii-string.h \
|
||||
byte-swapping.h \
|
||||
checked-overflow.h \
|
||||
+ compiler-macros.h \
|
||||
exit-with-parent.h \
|
||||
hexdigit.h \
|
||||
isaligned.h \
|
||||
@@ -55,6 +57,7 @@ EXTRA_DIST = \
|
||||
# Unit tests.
|
||||
|
||||
TESTS = \
|
||||
+ test-array-size \
|
||||
test-ascii-ctype \
|
||||
test-ascii-string \
|
||||
test-byte-swapping \
|
||||
@@ -69,6 +72,10 @@ TESTS = \
|
||||
$(NULL)
|
||||
check_PROGRAMS = $(TESTS)
|
||||
|
||||
+test_array_size_SOURCES = test-array-size.c array-size.h
|
||||
+test_array_size_CPPFLAGS = -I$(srcdir)
|
||||
+test_array_size_CFLAGS = $(WARNINGS_CFLAGS)
|
||||
+
|
||||
test_ascii_ctype_SOURCES = test-ascii-ctype.c ascii-ctype.h
|
||||
test_ascii_ctype_CPPFLAGS = -I$(srcdir)
|
||||
test_ascii_ctype_CFLAGS = $(WARNINGS_CFLAGS)
|
||||
diff --git a/common/include/array-size.h b/common/include/array-size.h
|
||||
new file mode 100644
|
||||
index 00000000..b6d33dde
|
||||
--- /dev/null
|
||||
+++ b/common/include/array-size.h
|
||||
@@ -0,0 +1,41 @@
|
||||
+/* nbdkit
|
||||
+ * Copyright (C) 2013-2022 Red Hat Inc.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions are
|
||||
+ * met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * * Neither the name of Red Hat nor the names of its contributors may be
|
||||
+ * used to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#ifndef NBDKIT_ARRAY_SIZE_H
|
||||
+#define NBDKIT_ARRAY_SIZE_H
|
||||
+
|
||||
+#include "compiler-macros.h"
|
||||
+
|
||||
+#define ARRAY_SIZE(a) \
|
||||
+ ((sizeof (a) / sizeof ((a)[0])) + BUILD_BUG_ON_ZERO (!TYPE_IS_ARRAY(a)))
|
||||
+
|
||||
+#endif /* NBDKIT_ARRAY_SIZE_H */
|
||||
diff --git a/common/include/compiler-macros.h b/common/include/compiler-macros.h
|
||||
new file mode 100644
|
||||
index 00000000..504e0085
|
||||
--- /dev/null
|
||||
+++ b/common/include/compiler-macros.h
|
||||
@@ -0,0 +1,60 @@
|
||||
+/* nbdkit
|
||||
+ * Copyright (C) 2013-2022 Red Hat Inc.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions are
|
||||
+ * met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * * Neither the name of Red Hat nor the names of its contributors may be
|
||||
+ * used to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ * SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#ifndef NBDKIT_COMPILER_MACROS_H
|
||||
+#define NBDKIT_COMPILER_MACROS_H
|
||||
+
|
||||
+#ifndef __cplusplus
|
||||
+
|
||||
+/* This expression fails at compile time if 'expr' is true. It does
|
||||
+ * this by constructing a struct which has an impossible
|
||||
+ * (negative-sized) array.
|
||||
+ *
|
||||
+ * If 'expr' is false then we subtract the sizes of the two identical
|
||||
+ * structures, returning zero.
|
||||
+ */
|
||||
+#define BUILD_BUG_ON_ZERO_SIZEOF(expr) \
|
||||
+ (sizeof (struct { int _array_size_failed[(expr) ? -1 : 1]; }))
|
||||
+#define BUILD_BUG_ON_ZERO(expr) \
|
||||
+ (BUILD_BUG_ON_ZERO_SIZEOF(expr) - BUILD_BUG_ON_ZERO_SIZEOF(expr))
|
||||
+
|
||||
+#define TYPE_IS_ARRAY(a) \
|
||||
+ (!__builtin_types_compatible_p (typeof (a), typeof (&(a)[0])))
|
||||
+
|
||||
+#else /* __cplusplus */
|
||||
+
|
||||
+#define BUILD_BUG_ON_ZERO(expr) 0
|
||||
+#define TYPE_IS_ARRAY(a) 1
|
||||
+
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#endif /* NBDKIT_COMPILER_MACROS_H */
|
||||
diff --git a/common/include/test-array-size.c b/common/include/test-array-size.c
|
||||
new file mode 100644
|
||||
index 00000000..d77ba3c9
|
||||
--- /dev/null
|
||||
+++ b/common/include/test-array-size.c
|
||||
@@ -0,0 +1,100 @@
|
||||
+/* nbdkit
|
||||
+ * Copyright (C) 2020-2022 Red Hat Inc.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions are
|
||||
+ * met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ *
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * * Neither the name of Red Hat nor the names of its contributors may be
|
||||
+ * used to endorse or promote products derived from this software without
|
||||
+ * specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
|
||||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
|
||||
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
+ * OR TORT (INCLUDING NEGLIGENCE 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 <stdlib.h>
|
||||
+#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */
|
||||
+#include <assert.h>
|
||||
+
|
||||
+#include "array-size.h"
|
||||
+
|
||||
+struct st { const char *s; int i; };
|
||||
+
|
||||
+static const char *s0[] = { };
|
||||
+static const char *s1[] = { "a" };
|
||||
+static const char *s3[] = { "a", "b", "c" };
|
||||
+static const char *s4[4] = { "a", "b", "c", "d" };
|
||||
+static int i0[] = { };
|
||||
+static int i1[] = { 1 };
|
||||
+static int i3[] = { 1, 2, 3 };
|
||||
+static int i4[4] = { 1, 2, 3, 4 };
|
||||
+static struct st st0[] = { };
|
||||
+static struct st st1[] = { { "a", 1 } };
|
||||
+static struct st st3[] = { { "a", 1 }, { "b", 2 }, { "c", 3 } };
|
||||
+static struct st st4[4] = { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } };
|
||||
+static struct st st4_0[4];
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ assert (ARRAY_SIZE (s0) == 0);
|
||||
+ assert (ARRAY_SIZE (s1) == 1);
|
||||
+ assert (ARRAY_SIZE (s3) == 3);
|
||||
+ assert (ARRAY_SIZE (s4) == 4);
|
||||
+ assert (ARRAY_SIZE (i0) == 0);
|
||||
+ assert (ARRAY_SIZE (i1) == 1);
|
||||
+ assert (ARRAY_SIZE (i3) == 3);
|
||||
+ assert (ARRAY_SIZE (i4) == 4);
|
||||
+ assert (ARRAY_SIZE (st0) == 0);
|
||||
+ assert (ARRAY_SIZE (st1) == 1);
|
||||
+ assert (ARRAY_SIZE (st3) == 3);
|
||||
+ assert (ARRAY_SIZE (st4) == 4);
|
||||
+ assert (ARRAY_SIZE (st4_0) == 4);
|
||||
+
|
||||
+#ifdef static_assert
|
||||
+ static_assert (ARRAY_SIZE (s0) == 0, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (s1) == 1, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (s3) == 3, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (s4) == 4, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (i0) == 0, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (i1) == 1, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (i3) == 3, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (i4) == 4, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (st0) == 0, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (st1) == 1, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (st3) == 3, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (st4) == 4, "ARRAY_SIZE macro does not work");
|
||||
+ static_assert (ARRAY_SIZE (st4_0) == 4, "ARRAY_SIZE macro does not work");
|
||||
+#endif
|
||||
+
|
||||
+ /* You can uncomment this to test the negative case. Unfortunately
|
||||
+ * it's difficult to automate this test.
|
||||
+ */
|
||||
+#if 0
|
||||
+ int *p = i4;
|
||||
+ assert (ARRAY_SIZE (p) == 4);
|
||||
+#endif
|
||||
+
|
||||
+ exit (EXIT_SUCCESS);
|
||||
+}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,342 +0,0 @@
|
||||
From a9cf21ef2e4770825d693e29f6b2d02d4291230e Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 7 Jul 2022 12:41:15 +0100
|
||||
Subject: [PATCH] Use ARRAY_SIZE macro in various places in nbdkit
|
||||
|
||||
(cherry picked from commit 0a077b95b23c1d9e2ffbad5e58fc8ae46a4e547e)
|
||||
---
|
||||
common/bitmap/test-bitmap.c | 3 ++-
|
||||
common/include/test-random.c | 5 ++---
|
||||
common/utils/Makefile.am | 1 +
|
||||
common/utils/test-quotes.c | 3 ++-
|
||||
plugins/ocaml/Makefile.am | 1 +
|
||||
plugins/ocaml/plugin.c | 14 ++++++++------
|
||||
plugins/ruby/Makefile.am | 1 +
|
||||
plugins/ruby/ruby.c | 5 +++--
|
||||
plugins/ssh/ssh.c | 4 ++--
|
||||
plugins/torrent/torrent.cpp | 5 ++---
|
||||
server/fuzzer.c | 4 +++-
|
||||
server/public.c | 3 ++-
|
||||
server/test-public.c | 4 +++-
|
||||
13 files changed, 32 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/common/bitmap/test-bitmap.c b/common/bitmap/test-bitmap.c
|
||||
index 69e4d9ff..657cc9aa 100644
|
||||
--- a/common/bitmap/test-bitmap.c
|
||||
+++ b/common/bitmap/test-bitmap.c
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#include <nbdkit-plugin.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "bitmap.h"
|
||||
|
||||
static void
|
||||
@@ -71,7 +72,7 @@ test (int bpb, int blksize)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
/* Set some bits at known block numbers. */
|
||||
- for (j = 0; j < sizeof blks / sizeof blks[0]; ++j) {
|
||||
+ for (j = 0; j < ARRAY_SIZE (blks); ++j) {
|
||||
v = (j & 1) == 0 ? 1 : (1<<bpb) - 1;
|
||||
bitmap_set_blk (&bm, blks[j], v);
|
||||
}
|
||||
diff --git a/common/include/test-random.c b/common/include/test-random.c
|
||||
index 16553ee6..f8fe3804 100644
|
||||
--- a/common/include/test-random.c
|
||||
+++ b/common/include/test-random.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "random.h"
|
||||
|
||||
/* This works by comparing the result to some known test vectors. It
|
||||
@@ -160,8 +161,6 @@ UINT64_C(0xc6ca62fc772728b0),
|
||||
} },
|
||||
};
|
||||
|
||||
-#define nr_tests (sizeof tests / sizeof tests[0])
|
||||
-
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
@@ -169,7 +168,7 @@ main (void)
|
||||
uint64_t r;
|
||||
unsigned errors = 0;
|
||||
|
||||
- for (i = 0; i < nr_tests; ++i) {
|
||||
+ for (i = 0; i < ARRAY_SIZE (tests); ++i) {
|
||||
struct random_state state;
|
||||
|
||||
printf ("seed: %" PRIu64 "\n", tests[i].seed);
|
||||
diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am
|
||||
index f8db853f..2c789015 100644
|
||||
--- a/common/utils/Makefile.am
|
||||
+++ b/common/utils/Makefile.am
|
||||
@@ -105,6 +105,7 @@ test_quotes_SOURCES = test-quotes.c quote.c utils.h
|
||||
test_quotes_CPPFLAGS = \
|
||||
-I$(srcdir) \
|
||||
-I$(top_srcdir)/common/replacements \
|
||||
+ -I$(top_srcdir)/common/include \
|
||||
$(NULL)
|
||||
test_quotes_CFLAGS = $(WARNINGS_CFLAGS)
|
||||
test_quotes_LDADD = \
|
||||
diff --git a/common/utils/test-quotes.c b/common/utils/test-quotes.c
|
||||
index bb825788..4960c7f8 100644
|
||||
--- a/common/utils/test-quotes.c
|
||||
+++ b/common/utils/test-quotes.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef HAVE_OPEN_MEMSTREAM
|
||||
@@ -93,7 +94,7 @@ main (void)
|
||||
size_t i;
|
||||
bool fail = false;
|
||||
|
||||
- for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
|
||||
+ for (i = 0; i < ARRAY_SIZE (tests); i++) {
|
||||
fail |= test (tests[i].orig, "shell_quote", shell_quote, tests[i].shell);
|
||||
fail |= test (tests[i].orig, "uri_quote", uri_quote, tests[i].uri);
|
||||
}
|
||||
diff --git a/plugins/ocaml/Makefile.am b/plugins/ocaml/Makefile.am
|
||||
index 0ee07f60..05624176 100644
|
||||
--- a/plugins/ocaml/Makefile.am
|
||||
+++ b/plugins/ocaml/Makefile.am
|
||||
@@ -69,6 +69,7 @@ libnbdkitocaml_la_SOURCES = \
|
||||
libnbdkitocaml_la_CPPFLAGS = \
|
||||
-I$(OCAMLLIB) \
|
||||
-I$(top_srcdir)/include \
|
||||
+ -I$(top_srcdir)/common/include \
|
||||
-DCAML_NAME_SPACE \
|
||||
$(NULL)
|
||||
|
||||
diff --git a/plugins/ocaml/plugin.c b/plugins/ocaml/plugin.c
|
||||
index 8dde45a0..2fe4e460 100644
|
||||
--- a/plugins/ocaml/plugin.c
|
||||
+++ b/plugins/ocaml/plugin.c
|
||||
@@ -49,6 +49,8 @@
|
||||
#define NBDKIT_API_VERSION 2
|
||||
#include <nbdkit-plugin.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
+
|
||||
#include "plugin.h"
|
||||
|
||||
/* This constructor runs when the plugin loads, and initializes the
|
||||
@@ -637,7 +639,7 @@ pread_wrapper (void *h, void *buf, uint32_t count, uint64_t offset,
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, countv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (pread_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (pread_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
@@ -666,7 +668,7 @@ pwrite_wrapper (void *h, const void *buf, uint32_t count, uint64_t offset,
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, strv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (pwrite_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (pwrite_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
@@ -705,7 +707,7 @@ trim_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags)
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, countv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (trim_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (trim_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
@@ -726,7 +728,7 @@ zero_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags)
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, countv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (zero_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (zero_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
@@ -748,7 +750,7 @@ extents_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags,
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, countv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (extents_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (extents_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
@@ -788,7 +790,7 @@ cache_wrapper (void *h, uint32_t count, uint64_t offset, uint32_t flags)
|
||||
flagsv = Val_flags (flags);
|
||||
|
||||
value args[] = { *(value *) h, countv, offsetv, flagsv };
|
||||
- rv = caml_callbackN_exn (cache_fn, sizeof args / sizeof args[0], args);
|
||||
+ rv = caml_callbackN_exn (cache_fn, ARRAY_SIZE (args), args);
|
||||
if (Is_exception_result (rv)) {
|
||||
nbdkit_error ("%s", caml_format_exception (Extract_exception (rv)));
|
||||
CAMLreturnT (int, -1);
|
||||
diff --git a/plugins/ruby/Makefile.am b/plugins/ruby/Makefile.am
|
||||
index 456d03b1..2453ba05 100644
|
||||
--- a/plugins/ruby/Makefile.am
|
||||
+++ b/plugins/ruby/Makefile.am
|
||||
@@ -47,6 +47,7 @@ nbdkit_ruby_plugin_la_SOURCES = \
|
||||
|
||||
nbdkit_ruby_plugin_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
+ -I$(top_srcdir)/common/include \
|
||||
$(NULL)
|
||||
nbdkit_ruby_plugin_la_CFLAGS = \
|
||||
$(WARNINGS_CFLAGS) \
|
||||
diff --git a/plugins/ruby/ruby.c b/plugins/ruby/ruby.c
|
||||
index a038d8e8..6aaf03e4 100644
|
||||
--- a/plugins/ruby/ruby.c
|
||||
+++ b/plugins/ruby/ruby.c
|
||||
@@ -44,6 +44,8 @@
|
||||
#include <ruby/version.h>
|
||||
#endif
|
||||
|
||||
+#include "array-size.h"
|
||||
+
|
||||
static VALUE nbdkit_module = Qnil;
|
||||
static int last_error;
|
||||
|
||||
@@ -206,8 +208,7 @@ plugin_rb_config (const char *key, const char *value)
|
||||
|
||||
/* Load the Ruby script into the interpreter. */
|
||||
const char *options[] = { "--", script };
|
||||
- code = ruby_options (sizeof options / sizeof options[0],
|
||||
- (char **) options);
|
||||
+ code = ruby_options (ARRAY_SIZE (options), (char **) options);
|
||||
|
||||
/* Check if we managed to compile the Ruby script to code. */
|
||||
if (!ruby_executable_node (code, &state)) {
|
||||
diff --git a/plugins/ssh/ssh.c b/plugins/ssh/ssh.c
|
||||
index 77cfcf6c..39d77e44 100644
|
||||
--- a/plugins/ssh/ssh.c
|
||||
+++ b/plugins/ssh/ssh.c
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <nbdkit-plugin.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "const-string-vector.h"
|
||||
#include "minmax.h"
|
||||
|
||||
@@ -82,10 +83,9 @@ log_callback (int priority, const char *function, const char *message, void *vp)
|
||||
{
|
||||
const char *levels[] =
|
||||
{ "none", "warning", "protocol", "packet", "function" };
|
||||
- const size_t nr_levels = sizeof levels / sizeof levels[0];
|
||||
const char *level;
|
||||
|
||||
- if (priority >= 0 && priority < nr_levels)
|
||||
+ if (priority >= 0 && priority < ARRAY_SIZE (levels))
|
||||
level = levels[priority];
|
||||
else
|
||||
level = "unknown";
|
||||
diff --git a/plugins/torrent/torrent.cpp b/plugins/torrent/torrent.cpp
|
||||
index d8cbda95..0dcf0d10 100644
|
||||
--- a/plugins/torrent/torrent.cpp
|
||||
+++ b/plugins/torrent/torrent.cpp
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/version.hpp>
|
||||
|
||||
+#include "array-size.h"
|
||||
extern "C" {
|
||||
#include "cleanup.h"
|
||||
};
|
||||
@@ -101,8 +102,6 @@ static struct setting settings[] = {
|
||||
{ "user-agent", "user_agent", pack.user_agent,
|
||||
STRING },
|
||||
};
|
||||
-static const size_t nr_settings = sizeof settings / sizeof settings[0];
|
||||
-
|
||||
static libtorrent::alert_category_t alerts =
|
||||
libtorrent::alert_category::error
|
||||
| libtorrent::alert_category::piece_progress
|
||||
@@ -221,7 +220,7 @@ torrent_config (const char *key, const char *value)
|
||||
|
||||
/* Settings. */
|
||||
else {
|
||||
- for (size_t i = 0; i < nr_settings; ++i) {
|
||||
+ for (size_t i = 0; i < ARRAY_SIZE (settings); ++i) {
|
||||
if (strcmp (key, settings[i].name) == 0 ||
|
||||
(settings[i].altname && strcmp (key, settings[i].altname) == 0)) {
|
||||
switch (settings[i].type) {
|
||||
diff --git a/server/fuzzer.c b/server/fuzzer.c
|
||||
index 4bbb0061..6c57e0f6 100644
|
||||
--- a/server/fuzzer.c
|
||||
+++ b/server/fuzzer.c
|
||||
@@ -43,6 +43,8 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
+
|
||||
#include "internal.h"
|
||||
|
||||
#ifndef ENABLE_LIBFUZZER
|
||||
@@ -122,7 +124,7 @@ server (int sock)
|
||||
"plugins/memory/.libs/nbdkit-memory-plugin." SOEXT, "1M",
|
||||
NULL
|
||||
};
|
||||
- const int argc = sizeof argv / sizeof argv[0] - 1;
|
||||
+ const int argc = ARRAY_SIZE (argv) - 1;
|
||||
int saved_stdin, saved_stdout;
|
||||
|
||||
/* Make the socket appear as stdin and stdout of the process, saving
|
||||
diff --git a/server/public.c b/server/public.c
|
||||
index d9ed0d9c..a93041fe 100644
|
||||
--- a/server/public.c
|
||||
+++ b/server/public.c
|
||||
@@ -70,6 +70,7 @@
|
||||
#include <pthread_time.h>
|
||||
#endif
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "ascii-ctype.h"
|
||||
#include "ascii-string.h"
|
||||
#include "get_current_dir_name.h"
|
||||
@@ -712,7 +713,7 @@ nbdkit_nanosleep (unsigned sec, unsigned nsec)
|
||||
*/
|
||||
if (sigfillset(&all))
|
||||
abort ();
|
||||
- switch (ppoll (fds, sizeof fds / sizeof fds[0], &ts, &all)) {
|
||||
+ switch (ppoll (fds, ARRAY_SIZE (fds), &ts, &all)) {
|
||||
case -1:
|
||||
assert (errno != EINTR);
|
||||
nbdkit_error ("poll: %m");
|
||||
diff --git a/server/test-public.c b/server/test-public.c
|
||||
index 2e6a7d8f..1cb759d1 100644
|
||||
--- a/server/test-public.c
|
||||
+++ b/server/test-public.c
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
+#include "array-size.h"
|
||||
+
|
||||
static bool error_flagged;
|
||||
|
||||
/* Stubs for linking against minimal source files, and for proving
|
||||
@@ -167,7 +169,7 @@ test_nbdkit_parse_size (void)
|
||||
{ "1E", 1024LL * 1024 * 1024 * 1024 * 1024 * 1024 },
|
||||
};
|
||||
|
||||
- for (i = 0; i < sizeof pairs / sizeof pairs[0]; i++) {
|
||||
+ for (i = 0; i < ARRAY_SIZE (pairs); i++) {
|
||||
int64_t r;
|
||||
|
||||
error_flagged = false;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From f758d534f4b4f701707c25f128fdde30dfe60c2c Mon Sep 17 00:00:00 2001
|
||||
From 75a84b37dba4907b790ebb2dc56ac689ea8370e7 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 14:00:16 +0100
|
||||
Subject: [PATCH] curl: Don't document curl plugin + readahead filter
|
@ -1,4 +1,4 @@
|
||||
From 9455de457dfced4ea247b0b5848e3d7fd748fb64 Mon Sep 17 00:00:00 2001
|
||||
From 46b2d3954011b2f0ebf5203ce549cb7e8f822b09 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 13:46:56 +0100
|
||||
Subject: [PATCH] New filter: scan
|
||||
@ -54,7 +54,7 @@ index 0f5dc41d..8600d9e4 100644
|
||||
single context into the backend shared among multiple client
|
||||
connections. This may even allow a filter to offer a more parallel
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d0c765af..fedb9383 100644
|
||||
index 7089f937..a02d16d9 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -142,6 +142,7 @@ filters="\
|
||||
@ -65,7 +65,7 @@ index d0c765af..fedb9383 100644
|
||||
stats \
|
||||
swab \
|
||||
tar \
|
||||
@@ -1400,6 +1401,7 @@ AC_CONFIG_FILES([Makefile
|
||||
@@ -1403,6 +1404,7 @@ AC_CONFIG_FILES([Makefile
|
||||
filters/readahead/Makefile
|
||||
filters/retry/Makefile
|
||||
filters/retry-request/Makefile
|
@ -1,78 +0,0 @@
|
||||
From 16fdeab315c865c2aeae1ebf896dc69d5ebdeffc Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 7 Jul 2022 08:57:36 +0100
|
||||
Subject: [PATCH] vddk: Demote another "phone home" error message to debug
|
||||
|
||||
Reported-by: Ming Xie
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2104720
|
||||
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
||||
(cherry picked from commit afa8cc84392af26641b340c58b836ca879698a53)
|
||||
---
|
||||
plugins/vddk/vddk.c | 32 +++++++++++++++++++++-----------
|
||||
1 file changed, 21 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
|
||||
index dbd3fdbe..35697bc1 100644
|
||||
--- a/plugins/vddk/vddk.c
|
||||
+++ b/plugins/vddk/vddk.c
|
||||
@@ -49,6 +49,7 @@
|
||||
#define NBDKIT_API_VERSION 2
|
||||
#include <nbdkit-plugin.h>
|
||||
|
||||
+#include "array-size.h"
|
||||
#include "cleanup.h"
|
||||
#include "minmax.h"
|
||||
#include "vector.h"
|
||||
@@ -495,11 +496,25 @@ debug_function (const char *fs, va_list args)
|
||||
nbdkit_debug ("%s", str);
|
||||
}
|
||||
|
||||
+/* VDDK 7 added some useless error messages about their "phone home"
|
||||
+ * system called CEIP which only panics users. Demote these to debug
|
||||
+ * statements below.
|
||||
+ *
|
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1834267
|
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2083617
|
||||
+ * https://bugzilla.redhat.com/show_bug.cgi?id=2104720
|
||||
+ */
|
||||
+static const char * const demoted_errors[] = {
|
||||
+ "Get CEIP status failed",
|
||||
+ "VDDK_PhoneHome:",
|
||||
+};
|
||||
+
|
||||
/* Turn error messages from the library into nbdkit_error. */
|
||||
static void
|
||||
error_function (const char *fs, va_list args)
|
||||
{
|
||||
CLEANUP_FREE char *str = NULL;
|
||||
+ size_t i;
|
||||
|
||||
/* If the thread-local error_suppression flag is non-zero then we
|
||||
* will suppress error messages from VDDK in this thread.
|
||||
@@ -513,17 +528,12 @@ error_function (const char *fs, va_list args)
|
||||
|
||||
trim (str);
|
||||
|
||||
- /* VDDK 7 added some useless error messages about their "phone home"
|
||||
- * system called CEIP which only panics users. Demote to a debug
|
||||
- * statement.
|
||||
- * https://bugzilla.redhat.com/show_bug.cgi?id=1834267
|
||||
- * https://bugzilla.redhat.com/show_bug.cgi?id=2083617
|
||||
- */
|
||||
- if (strstr (str, "Get CEIP status failed") != NULL ||
|
||||
- strstr (str, "VDDK_PhoneHome: Unable to load configuration "
|
||||
- "options from ") != NULL) {
|
||||
- nbdkit_debug ("%s", str);
|
||||
- return;
|
||||
+ /* See comment above about demoted errors. */
|
||||
+ for (i = 0; i < ARRAY_SIZE (demoted_errors); ++i) {
|
||||
+ if (strstr (str, demoted_errors[i]) != NULL) {
|
||||
+ nbdkit_debug ("%s", str);
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
nbdkit_error ("%s", str);
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,64 +0,0 @@
|
||||
From 47d80b6020a739e9f005de24d4928721854da8dc Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 7 Jul 2022 14:06:25 +0100
|
||||
Subject: [PATCH] common/include/test-array-size.c: Avoid Clang warning
|
||||
|
||||
On Clang with warn-error enabled:
|
||||
|
||||
test-array-size.c:44:20: error: variable 's0' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
|
||||
static const char *s0[] = { };
|
||||
^
|
||||
test-array-size.c:45:20: error: variable 's1' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
|
||||
static const char *s1[] = { "a" };
|
||||
^
|
||||
|
||||
(etc)
|
||||
|
||||
Updates: commit 0fa23df5cd5dc97a55857416ea81d5de6d867c18
|
||||
(cherry picked from commit 90f5dbf78bb56cb00d6b3c58fa0a9b390d50e25e)
|
||||
---
|
||||
common/include/test-array-size.c | 28 +++++++++++++++-------------
|
||||
1 file changed, 15 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/common/include/test-array-size.c b/common/include/test-array-size.c
|
||||
index d77ba3c9..1ce2142c 100644
|
||||
--- a/common/include/test-array-size.c
|
||||
+++ b/common/include/test-array-size.c
|
||||
@@ -41,19 +41,21 @@
|
||||
|
||||
struct st { const char *s; int i; };
|
||||
|
||||
-static const char *s0[] = { };
|
||||
-static const char *s1[] = { "a" };
|
||||
-static const char *s3[] = { "a", "b", "c" };
|
||||
-static const char *s4[4] = { "a", "b", "c", "d" };
|
||||
-static int i0[] = { };
|
||||
-static int i1[] = { 1 };
|
||||
-static int i3[] = { 1, 2, 3 };
|
||||
-static int i4[4] = { 1, 2, 3, 4 };
|
||||
-static struct st st0[] = { };
|
||||
-static struct st st1[] = { { "a", 1 } };
|
||||
-static struct st st3[] = { { "a", 1 }, { "b", 2 }, { "c", 3 } };
|
||||
-static struct st st4[4] = { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } };
|
||||
-static struct st st4_0[4];
|
||||
+static const char *s0[] __attribute__((__unused__)) = { };
|
||||
+static const char *s1[] __attribute__((__unused__)) = { "a" };
|
||||
+static const char *s3[] __attribute__((__unused__)) = { "a", "b", "c" };
|
||||
+static const char *s4[4] __attribute__((__unused__)) = { "a", "b", "c", "d" };
|
||||
+static int i0[] __attribute__((__unused__)) = { };
|
||||
+static int i1[] __attribute__((__unused__)) = { 1 };
|
||||
+static int i3[] __attribute__((__unused__)) = { 1, 2, 3 };
|
||||
+static int i4[4] __attribute__((__unused__)) = { 1, 2, 3, 4 };
|
||||
+static struct st st0[] __attribute__((__unused__)) = { };
|
||||
+static struct st st1[] __attribute__((__unused__)) = { { "a", 1 } };
|
||||
+static struct st st3[] __attribute__((__unused__)) =
|
||||
+ { { "a", 1 }, { "b", 2 }, { "c", 3 } };
|
||||
+static struct st st4[4] __attribute__((__unused__)) =
|
||||
+ { { "a", 1 }, { "b", 2 }, { "c", 3 }, { "d", 4 } };
|
||||
+static struct st st4_0[4] __attribute__((__unused__));
|
||||
|
||||
int
|
||||
main (void)
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,4 +1,4 @@
|
||||
From fc1094e63f2c23667e4f04a0f8e513855242d845 Mon Sep 17 00:00:00 2001
|
||||
From fd743f16847520207304e7f7f66839708abaffd9 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 18:54:32 +0100
|
||||
Subject: [PATCH] scan: Remove condition variable
|
@ -1,4 +1,4 @@
|
||||
From 337d8bbe3f6f03631e2a4df05cf63d586d9eeeea Mon Sep 17 00:00:00 2001
|
||||
From f5e7beb490131d5674b7c1ff8b312da3f6d5e078 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 19:02:48 +0100
|
||||
Subject: [PATCH] scan: Small typographical fix in manual
|
@ -1,4 +1,4 @@
|
||||
From a11e0ecf22a4dff319fb679f67cb51594069e6df Mon Sep 17 00:00:00 2001
|
||||
From 1bd582bce19ed3beb27879a1bfcee247d22c7fba Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 14 May 2022 20:57:38 +0100
|
||||
Subject: [PATCH] ssh: Don't reference readahead or scan filters from this
|
@ -1,4 +1,4 @@
|
||||
From b892407cda17f6e13e93be65b04b25b10b628714 Mon Sep 17 00:00:00 2001
|
||||
From cad7357b2d4dd70bd75adbbd44aa1715bd0d090c Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 17 May 2022 13:20:17 +0100
|
||||
Subject: [PATCH] scan: Fix bound so we don't try to prefetch beyond end of
|
@ -1,4 +1,4 @@
|
||||
From 944a788490b88a7543052206c50de15f02b75206 Mon Sep 17 00:00:00 2001
|
||||
From ec7154cb4010e5c20ae8b1df8a95550bc5e42ee2 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 10 Jun 2022 22:11:44 +0100
|
||||
Subject: [PATCH] tests: Add a regression test for LUKS zeroing crash
|
@ -1,4 +1,4 @@
|
||||
From 97ce9ab67bc2e38461160e8c9183cc8d74fdc3a1 Mon Sep 17 00:00:00 2001
|
||||
From 7c7557d9954eb7d8fa6249af316879dada22829d Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sat, 11 Jun 2022 12:34:02 +0100
|
||||
Subject: [PATCH] rate: Allow burstiness to be controlled
|
63
nbdkit.spec
63
nbdkit.spec
@ -52,8 +52,8 @@ ExclusiveArch: x86_64
|
||||
%global source_directory 1.30-stable
|
||||
|
||||
Name: nbdkit
|
||||
Version: 1.30.6
|
||||
Release: 3%{?dist}
|
||||
Version: 1.30.7
|
||||
Release: 1%{?dist}
|
||||
Summary: NBD server
|
||||
|
||||
License: BSD
|
||||
@ -78,39 +78,25 @@ Source3: copy-patches.sh
|
||||
# https://gitlab.com/nbdkit/nbdkit/-/commits/rhel-9.1/
|
||||
|
||||
# Patches.
|
||||
Patch0001: 0001-docs-nbdkit-protocol.pod-block-size-support-was-adde.patch
|
||||
Patch0002: 0002-perl-Move-GCC-diagnostic-ignored-earlier.patch
|
||||
Patch0003: 0003-ocaml-Add-valgrind-suppression-for-OCaml-4.14-bug.patch
|
||||
Patch0004: 0004-ocaml-Add-further-valgrind-suppression.patch
|
||||
Patch0005: 0005-valgrind-Update-comment-about-valgrind-bug-affecting.patch
|
||||
Patch0006: 0006-exitwhen-Check-nbdkit-doesn-t-exit-before-the-pipe-i.patch
|
||||
Patch0007: 0007-server-Display-kTLS-setting-in-debug-output.patch
|
||||
Patch0008: 0008-server-Work-around-incorrect-include-in-gnutls-socke.patch
|
||||
Patch0009: 0009-tests-test-parallel-sh.sh-Small-cleanups.patch
|
||||
Patch0010: 0010-tests-test-parallel-sh.sh-Skip-test-under-valgrind-d.patch
|
||||
Patch0011: 0011-common-include-Add-ARRAY_SIZE-macro.patch
|
||||
Patch0012: 0012-Use-ARRAY_SIZE-macro-in-various-places-in-nbdkit.patch
|
||||
Patch0013: 0013-vddk-Demote-another-phone-home-error-message-to-debu.patch
|
||||
Patch0014: 0014-common-include-test-array-size.c-Avoid-Clang-warning.patch
|
||||
Patch0015: 0015-ssh-Allow-the-remote-file-to-be-created.patch
|
||||
Patch0016: 0016-readahead-Rewrite-this-filter-so-it-prefetches-using.patch
|
||||
Patch0017: 0017-readahead-Fix-test.patch
|
||||
Patch0018: 0018-New-filter-luks.patch
|
||||
Patch0019: 0019-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch
|
||||
Patch0020: 0020-luks-Various-fixes-for-Clang.patch
|
||||
Patch0021: 0021-luks-Link-with-libcompat-on-Windows.patch
|
||||
Patch0022: 0022-luks-Refactor-the-filter.patch
|
||||
Patch0023: 0023-tests-luks-Reduce-time-taken-to-run-these-tests.patch
|
||||
Patch0024: 0024-Add-nbdkit.parse_size-Python-function.patch
|
||||
Patch0025: 0025-cache-Fix-cross-reference-nbdkit-readahead-filter.patch
|
||||
Patch0026: 0026-curl-Don-t-document-curl-plugin-readahead-filter.patch
|
||||
Patch0027: 0027-New-filter-scan.patch
|
||||
Patch0028: 0028-scan-Remove-condition-variable.patch
|
||||
Patch0029: 0029-scan-Small-typographical-fix-in-manual.patch
|
||||
Patch0030: 0030-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch
|
||||
Patch0031: 0031-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch
|
||||
Patch0032: 0032-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch
|
||||
Patch0033: 0033-rate-Allow-burstiness-to-be-controlled.patch
|
||||
Patch0001: 0001-ssh-Allow-the-remote-file-to-be-created.patch
|
||||
Patch0002: 0002-readahead-Rewrite-this-filter-so-it-prefetches-using.patch
|
||||
Patch0003: 0003-readahead-Fix-test.patch
|
||||
Patch0004: 0004-New-filter-luks.patch
|
||||
Patch0005: 0005-luks-Disable-filter-with-old-GnuTLS-in-Debian-10.patch
|
||||
Patch0006: 0006-luks-Various-fixes-for-Clang.patch
|
||||
Patch0007: 0007-luks-Link-with-libcompat-on-Windows.patch
|
||||
Patch0008: 0008-luks-Refactor-the-filter.patch
|
||||
Patch0009: 0009-tests-luks-Reduce-time-taken-to-run-these-tests.patch
|
||||
Patch0010: 0010-Add-nbdkit.parse_size-Python-function.patch
|
||||
Patch0011: 0011-cache-Fix-cross-reference-nbdkit-readahead-filter.patch
|
||||
Patch0012: 0012-curl-Don-t-document-curl-plugin-readahead-filter.patch
|
||||
Patch0013: 0013-New-filter-scan.patch
|
||||
Patch0014: 0014-scan-Remove-condition-variable.patch
|
||||
Patch0015: 0015-scan-Small-typographical-fix-in-manual.patch
|
||||
Patch0016: 0016-ssh-Don-t-reference-readahead-or-scan-filters-from-t.patch
|
||||
Patch0017: 0017-scan-Fix-bound-so-we-don-t-try-to-prefetch-beyond-en.patch
|
||||
Patch0018: 0018-tests-Add-a-regression-test-for-LUKS-zeroing-crash.patch
|
||||
Patch0019: 0019-rate-Allow-burstiness-to-be-controlled.patch
|
||||
|
||||
# For automatic RPM Provides generation.
|
||||
# See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
|
||||
@ -1218,8 +1204,8 @@ export LIBGUESTFS_TRACE=1
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jul 07 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.6-3
|
||||
- Rebase to new stable branch version 1.30.6
|
||||
* Tue Jul 12 2022 Richard W.M. Jones <rjones@redhat.com> - 1.30.7-1
|
||||
- Rebase to new stable branch version 1.30.7
|
||||
resolves: rhbz#2059289
|
||||
- Add automatic provides generator and subpackage nbdkit-srpm-macros
|
||||
resolves: rhbz#2059291
|
||||
@ -1243,7 +1229,8 @@ export LIBGUESTFS_TRACE=1
|
||||
resolves: rhbz#2104720
|
||||
- vddk: Clearer error message when thumbprint is wrong
|
||||
resolves: rhbz#1905772
|
||||
- Fix memory allocator=malloc,mlock=true (2044432)
|
||||
- Fix memory allocator=malloc,mlock=true
|
||||
resolves: rhbz#2044432
|
||||
|
||||
* Mon Jan 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.28.5-1
|
||||
- Rebase to new stable branch version 1.28.5
|
||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (nbdkit-1.30.6.tar.gz) = c12b4931411894d59bed32551d1a89326f88e19569ce278531df5de9a2fb32118a6092af83596d99f5a50f792e3cfa676809abb533e75263a3100a0772c008c4
|
||||
SHA512 (nbdkit-1.30.6.tar.gz.sig) = 21a7e3f2747f5b9ef7f7c1acfaa21024e1d6dcdc2f541ec8c4146ccffb9c7d8d3b6fb57fe8c9968d5db8454b616dd8e221a2a766baef4528629f0b9f3dd5b835
|
||||
SHA512 (nbdkit-1.30.7.tar.gz) = acf48dc8f2b2d8967aca106f9c267cd8f022c54dbe07d1f32c8b5d14df33215f71029622f095fef1a442a2ab495618e81844b0b5f4a24b2be2869b3b3c990bf1
|
||||
SHA512 (nbdkit-1.30.7.tar.gz.sig) = 46f5c265240b447af7703ec8bce473e5951452c163c8f302291e3495c4c6ca5790b9382063c68613390bccf998d8c18efddda4878870af72029b854bb69e308e
|
||||
|
Loading…
Reference in New Issue
Block a user