nbdkit/0004-plugins-python-Fix-extents-count-format-string.patch
Richard W.M. Jones b5f8430a27 Rebase to new stable branch version 1.28.3
resolves: rhbz#2011709

Includes these important commits:
    plugins/python: Fix extents() count format string
    tests: Add configure --disable-libguestfs-tests flag
    tests: Use mke2fs -d to create ext4 test image

Use new --disable-libguestfs-tests on non-guestfs arches.
2021-12-19 10:51:16 +00:00

36 lines
1.3 KiB
Diff

From 79a8b12a1fea3803e09c0d6fc587a09f03023ac8 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sun, 19 Dec 2021 09:09:39 +0200
Subject: [PATCH] plugins/python: Fix extents() count format string
The plugin used "i" (int32) instead of "I" (uint32) for the count, so
when the client asks for 4294966784 bytes, the python plugin got -512.
nbdkit: python.0: debug: python: extents count=4294966784 offset=0 req_one=0
...
nbdkit: python.0: debug: extents: count=-512 offset=0 flags=0
With this fix I can get extents from rhv-upload-plugin using nbdinfo.
(cherry picked from commit 715e9c238650e5f60b50a7c87c76037c0a4d4bfe)
---
plugins/python/plugin.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/python/plugin.c b/plugins/python/plugin.c
index f85512b4..366619f9 100644
--- a/plugins/python/plugin.c
+++ b/plugins/python/plugin.c
@@ -964,7 +964,7 @@ py_extents (void *handle, uint32_t count, uint64_t offset,
if (callback_defined ("extents", &fn)) {
PyErr_Clear ();
- r = PyObject_CallFunction (fn, "OiLI", h->py_h, count, offset, flags);
+ r = PyObject_CallFunction (fn, "OILI", h->py_h, count, offset, flags);
Py_DECREF (fn);
if (check_python_failure ("extents") == -1)
return -1;
--
2.31.1