From 149038540362db6658208d97e8c8b3a8ea492f09 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 17:36:29 +0100 Subject: [PATCH] Add fixes for 32 bit platforms i686 and armv7. --- ...-bash-Don-t-define-bashcompdir-twice.patch | 2 +- ...s-to-improve-the-flow-of-the-man-pag.patch | 2 +- ...ng-Add-illustrations-to-the-man-page.patch | 2 +- ...ua-into-alphabetical-order-in-the-li.patch | 2 +- 0005-Add-pattern-plugin.patch | 2 +- ...d-a-second-test-of-the-offset-filter.patch | 2 +- ...ts-Test-largest-possible-plugin-size.patch | 2 +- ...x-broken-cross-reference-in-man-page.patch | 2 +- ...ome-over-long-lines-in-documentation.patch | 2 +- ...-docs-Add-podwrapper-from-libguestfs.patch | 2 +- 0011-Rework-README-file.patch | 230 ++++++++++++++++++ ...dom-Make-these-plugins-work-on-32-bi.patch | 142 +++++++++++ nbdkit.spec | 3 + 13 files changed, 385 insertions(+), 10 deletions(-) create mode 100644 0011-Rework-README-file.patch create mode 100644 0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch diff --git a/0001-bash-Don-t-define-bashcompdir-twice.patch b/0001-bash-Don-t-define-bashcompdir-twice.patch index 00fd704..dc7fcb7 100644 --- a/0001-bash-Don-t-define-bashcompdir-twice.patch +++ b/0001-bash-Don-t-define-bashcompdir-twice.patch @@ -1,7 +1,7 @@ From ef13e7db5d9d8e5ff6977821c3e798bb6c7725d9 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 10 Jul 2018 10:28:44 +0100 -Subject: [PATCH 01/10] bash: Don't define bashcompdir twice. +Subject: [PATCH 01/12] bash: Don't define bashcompdir twice. --- bash/Makefile.am | 1 - diff --git a/0002-xz-Minor-rewrites-to-improve-the-flow-of-the-man-pag.patch b/0002-xz-Minor-rewrites-to-improve-the-flow-of-the-man-pag.patch index ee26f6e..8ce1119 100644 --- a/0002-xz-Minor-rewrites-to-improve-the-flow-of-the-man-pag.patch +++ b/0002-xz-Minor-rewrites-to-improve-the-flow-of-the-man-pag.patch @@ -1,7 +1,7 @@ From 9fb8c7b550cddb6504386a8776e0abaeac4c1f20 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 14 Jul 2018 21:25:13 +0100 -Subject: [PATCH 02/10] xz: Minor rewrites to improve the flow of the man page. +Subject: [PATCH 02/12] xz: Minor rewrites to improve the flow of the man page. --- plugins/xz/nbdkit-xz-plugin.pod | 26 ++++++++++++++------------ diff --git a/0003-streaming-Add-illustrations-to-the-man-page.patch b/0003-streaming-Add-illustrations-to-the-man-page.patch index 0f8d30d..77fe932 100644 --- a/0003-streaming-Add-illustrations-to-the-man-page.patch +++ b/0003-streaming-Add-illustrations-to-the-man-page.patch @@ -1,7 +1,7 @@ From 166be40fa335649caf2615b384cc006d92bc5170 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 11:14:49 +0100 -Subject: [PATCH 03/10] streaming: Add illustrations to the man page. +Subject: [PATCH 03/12] streaming: Add illustrations to the man page. Also improve the flow of the language and provide cross-reference to captive nbdkit. diff --git a/0004-tests-Put-test.lua-into-alphabetical-order-in-the-li.patch b/0004-tests-Put-test.lua-into-alphabetical-order-in-the-li.patch index 7a43b0a..d0b4d72 100644 --- a/0004-tests-Put-test.lua-into-alphabetical-order-in-the-li.patch +++ b/0004-tests-Put-test.lua-into-alphabetical-order-in-the-li.patch @@ -1,7 +1,7 @@ From bc3b8c27b40165af6d7dcca15dfae98cbf7566e8 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 11:51:39 +0100 -Subject: [PATCH 04/10] tests: Put test.lua into alphabetical order in the +Subject: [PATCH 04/12] tests: Put test.lua into alphabetical order in the list. Fixes commit ff2b304e9c5ddef01081b9aef113bf0cf6dfabac. diff --git a/0005-Add-pattern-plugin.patch b/0005-Add-pattern-plugin.patch index 22fff7c..1b063c9 100644 --- a/0005-Add-pattern-plugin.patch +++ b/0005-Add-pattern-plugin.patch @@ -1,7 +1,7 @@ From 0a9205dc8c3b5d5703bd71bc58db503c05b0063b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 7 Jul 2018 13:30:32 +0100 -Subject: [PATCH 05/10] Add pattern plugin. +Subject: [PATCH 05/12] Add pattern plugin. This generates a simple, fixed test pattern which can be used to test nbdkit filters (especially nbdkit-offset-filter), and also NBD diff --git a/0006-tests-Add-a-second-test-of-the-offset-filter.patch b/0006-tests-Add-a-second-test-of-the-offset-filter.patch index e5de95a..44ffb29 100644 --- a/0006-tests-Add-a-second-test-of-the-offset-filter.patch +++ b/0006-tests-Add-a-second-test-of-the-offset-filter.patch @@ -1,7 +1,7 @@ From 97a5e57037aa0130a1e46aa6162171d941a58d62 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 7 Jul 2018 14:10:11 +0100 -Subject: [PATCH 06/10] tests: Add a second test of the offset filter. +Subject: [PATCH 06/12] tests: Add a second test of the offset filter. This tests that the offset filter works for non-aligned offsets and that nbdkit can handle virtual disks which are ~ 2^63 bits in size. diff --git a/0007-tests-Test-largest-possible-plugin-size.patch b/0007-tests-Test-largest-possible-plugin-size.patch index 8b7971c..f8e3d3e 100644 --- a/0007-tests-Test-largest-possible-plugin-size.patch +++ b/0007-tests-Test-largest-possible-plugin-size.patch @@ -1,7 +1,7 @@ From 4e1a521228115c04cc7c5a2f625218a9bbd5101f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 11:46:12 +0100 -Subject: [PATCH 07/10] tests: Test largest possible plugin size. +Subject: [PATCH 07/12] tests: Test largest possible plugin size. This test is incomplete because it is too large for qemu to open. However at least we are testing that nbdkit works. diff --git a/0008-docs-Fix-broken-cross-reference-in-man-page.patch b/0008-docs-Fix-broken-cross-reference-in-man-page.patch index dd2fdc9..127cee6 100644 --- a/0008-docs-Fix-broken-cross-reference-in-man-page.patch +++ b/0008-docs-Fix-broken-cross-reference-in-man-page.patch @@ -1,7 +1,7 @@ From 4c3ea9514184958c356ff6f613d43b896cb26b0e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 15:15:44 +0100 -Subject: [PATCH 08/10] docs: Fix broken cross-reference in man page. +Subject: [PATCH 08/12] docs: Fix broken cross-reference in man page. --- docs/nbdkit-filter.pod.in | 2 +- diff --git a/0009-docs-Break-up-some-over-long-lines-in-documentation.patch b/0009-docs-Break-up-some-over-long-lines-in-documentation.patch index 53dacc1..f300047 100644 --- a/0009-docs-Break-up-some-over-long-lines-in-documentation.patch +++ b/0009-docs-Break-up-some-over-long-lines-in-documentation.patch @@ -1,7 +1,7 @@ From cf495ffb975d4557a6092a19f382a9a69b457300 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 16:26:18 +0100 -Subject: [PATCH 09/10] docs: Break up some over-long lines in documentation. +Subject: [PATCH 09/12] docs: Break up some over-long lines in documentation. We will enforce a limit of 76 chars (in most cases) in a future commit. diff --git a/0010-docs-Add-podwrapper-from-libguestfs.patch b/0010-docs-Add-podwrapper-from-libguestfs.patch index fc6e859..33e0b7c 100644 --- a/0010-docs-Add-podwrapper-from-libguestfs.patch +++ b/0010-docs-Add-podwrapper-from-libguestfs.patch @@ -1,7 +1,7 @@ From 24a0a8ced608395b614ad42ae550588e08d3c636 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 15 Jul 2018 14:13:53 +0100 -Subject: [PATCH 10/10] docs: Add podwrapper from libguestfs. +Subject: [PATCH 10/12] docs: Add podwrapper from libguestfs. Use podwrapper from libguestfs to generate man pages instead of pod2man. This allows finer control over how man pages are generated, diff --git a/0011-Rework-README-file.patch b/0011-Rework-README-file.patch new file mode 100644 index 0000000..0facc9d --- /dev/null +++ b/0011-Rework-README-file.patch @@ -0,0 +1,230 @@ +From 730f8388467426bfd061151205d93391c942b86a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sun, 15 Jul 2018 17:26:59 +0100 +Subject: [PATCH 11/12] Rework README file. + +--- + README | 119 +++++++++++++++++++++++++++++++-------------------------- + 1 file changed, 65 insertions(+), 54 deletions(-) + +diff --git a/README b/README +index 685b41f..5114b31 100644 +--- a/README ++++ b/README +@@ -1,7 +1,7 @@ +-NBD is a protocol for accessing Block Devices (hard disks and +-disk-like things) over a Network. ++NBD — Network Block Device — is a protocol for accessing Block Devices ++(hard disks and disk-like things) over a Network. + +-'nbdkit' is a toolkit for creating NBD servers. ++nbdkit is a toolkit for creating NBD servers. + + The key features are: + +@@ -13,24 +13,39 @@ The key features are: + libraries or included in proprietary code. + + * Well-documented, simple plugin API with a stable ABI guarantee. +- Lets you export "unconventional" block devices easily. ++ Lets you export “unconventional” block devices easily. + + * You can write plugins in C, Lua, Perl, Python, OCaml, Ruby or Tcl. + +-For documentation, see the docs/ directory. ++ * Filters can be stacked in front of plugins to transform the output. + +-For plugins and examples, see the plugins/ directory. ++For documentation, see the ‘docs/’ directory. + +-License +-------- ++For plugins, examples and filters, see the ‘plugins/’ and ‘filters/’ ++directories. ++ ++LICENSE ++======= + + This software is copyright (C) Red Hat Inc. and licensed under a BSD +-license. See LICENSE for details. ++license. See ‘LICENSE’ for details. + +-Building from source +--------------------- ++BUILDING FROM SOURCE ++==================== + +-By default nbdkit needs nothing except Linux and reasonably recent gcc. ++Requirements ++------------ ++ ++To build the basic server and some plugins nbdkit needs nothing except ++Linux and reasonably recent gcc. ++ ++Although it is possible to build without it, it’s recommended to ++enable TLS support for which you will need: ++ ++ - gnutls >= 3.3.0 ++ ++Optional dependencies ++--------------------- + + To build the man pages, you will optionally need to install: + +@@ -38,13 +53,6 @@ To build the man pages, you will optionally need to install: + + - Pod::Man and Pod::Simple (perl library) + +-There are some *optional* libraries you may want to install for +-plugins or extra features. +- +-For TLS support: +- +- - gnutls >= 3.3.0 +- + For the gzip plugin: + + - zlib +@@ -79,19 +87,22 @@ For the VDDK plugin: + + For the Perl, example4 and tar plugins: + ++ - perl interpreter ++ + - perl development libraries + + - perl module ExtUtils::Embed + + For the Python plugin: + +- - python development libraries ++ - python interpreter + (either version 2 or 3 may be used) + ++ - python development libraries ++ + For the OCaml plugin: + +- - OCaml >= 4.02.2 which has support for shared libraries, see: +- http://caml.inria.fr/mantis/view.php?id=6693 ++ - OCaml >= 4.02.2 + + For the Tcl plugin: + +@@ -109,81 +120,81 @@ To run the test suite: + + - bash + +-To test for memory leaks ('make check-valgrind'): ++To test for memory leaks (‘make check-valgrind’): + + - valgrind program and development headers + + For non-essential enhancements to the test suite: + ++ - qemu-io (usually shipped with qemu) ++ + - socat + + - ss (from iproute package) + +-After installing any dependencies: ++Building ++-------- + +- To build from tarball: To build from git: +- ---------------------- ------------------ +- autoreconf -i +- ./configure ./configure +- make make +- make check make check ++ To build from tarball: To build from git: ++ ---------------------- ------------------ ++ autoreconf -i ++ ./configure ./configure ++ make make ++ make check make check + + To run nbdkit from the source directory, use the top level ./nbdkit + script. It will run nbdkit and plugins from the locally compiled + directory: + +- $ ./nbdkit example1 -f -v +- ./src/nbdkit ./plugins/example1/.libs/nbdkit-example1-plugin.so -f -v +- [etc] ++ $ ./nbdkit example1 -f -v ++ ./src/nbdkit ./plugins/example1/.libs/nbdkit-example1-plugin.so -f -v ++ [etc] + + Optionally run this command as root to install everything: + +- make install ++ make install + + Python + ------ + + By default nbdkit uses the Python version of the Python interpreter +-called "python" on the current $PATH. To use another version of ++called “python” on the current $PATH. To use another version of + Python you may need to set the PYTHON variable when configuring. For + example: + +- ./configure PYTHON=/usr/bin/python3 ++ ./configure PYTHON=/usr/bin/python3 + +-Tests +------ ++Running the tests ++----------------- + + You will need to install libguestfs to run most of the test suite: + +- make check ++ make check + + The test suite is fairly comprehensive. It runs the newly built + nbdkit + plugins as a captive process, and tests them using + libguestfs. If there is a failure, look at the corresponding +-tests/*.log file for debug information. ++‘tests/*.log’ file for debug information. + +-Developers +----------- ++DOWNLOAD TARBALLS ++================= ++ ++Tarballs are available from: ++http://libguestfs.org/download/nbdkit ++ ++DEVELOPERS ++========== + + Install the valgrind program and development headers. + + Use: + +- ./configure --enable-gcc-warnings --enable-valgrind ++ ./configure --enable-gcc-warnings --enable-valgrind + + When testing use: + +- make check +- make check-valgrind +- +-Packager information +--------------------- +- +-Tarballs are available from: +-http://libguestfs.org/download/nbdkit +- +-Developer information +---------------------- ++ make check ++ make check-valgrind + + For development ideas, see the TODO file. + +-- +2.17.1 + diff --git a/0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch b/0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch new file mode 100644 index 0000000..715b04e --- /dev/null +++ b/0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch @@ -0,0 +1,142 @@ +From 0c710f36c5e686ae0f02c67dc6b19e1622e23d8a Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sun, 15 Jul 2018 17:32:22 +0100 +Subject: [PATCH 12/12] null, pattern, random: Make these plugins work on 32 + bit machines. + +These plugins had copied code from the nbdkit-memory-plugin. The +memory plugin needs to store actual data in an array so uses size_t. +However these other plugins don't have to store anything and so shoule +use int64_t, enabling them to work on 32 bit platforms. +--- + plugins/null/null.c | 10 +++------- + plugins/pattern/pattern.c | 12 ++++-------- + plugins/random/random.c | 12 ++++-------- + 3 files changed, 11 insertions(+), 23 deletions(-) + +diff --git a/plugins/null/null.c b/plugins/null/null.c +index 905cc64..1daafac 100644 +--- a/plugins/null/null.c ++++ b/plugins/null/null.c +@@ -44,7 +44,7 @@ + #include + + /* The size of disk in bytes (initialized by size= parameter). */ +-static size_t size = 0; ++static int64_t size = 0; + + static int + null_config (const char *key, const char *value) +@@ -55,11 +55,7 @@ null_config (const char *key, const char *value) + r = nbdkit_parse_size (value); + if (r == -1) + return -1; +- if (r > SIZE_MAX) { +- nbdkit_error ("size > SIZE_MAX"); +- return -1; +- } +- size = (ssize_t) r; ++ size = r; + } + else { + nbdkit_error ("unknown parameter '%s'", key); +@@ -108,7 +104,7 @@ null_close (void *handle) + static int64_t + null_get_size (void *handle) + { +- return (int64_t) size; ++ return size; + } + + /* Read data. */ +diff --git a/plugins/pattern/pattern.c b/plugins/pattern/pattern.c +index e1dc798..11b258d 100644 +--- a/plugins/pattern/pattern.c ++++ b/plugins/pattern/pattern.c +@@ -45,7 +45,7 @@ + #include + + /* The size of disk in bytes (initialized by size= parameter). */ +-static size_t size = 0; ++static int64_t size = 0; + + static int + pattern_config (const char *key, const char *value) +@@ -56,11 +56,7 @@ pattern_config (const char *key, const char *value) + r = nbdkit_parse_size (value); + if (r == -1) + return -1; +- if (r > SIZE_MAX) { +- nbdkit_error ("size > SIZE_MAX"); +- return -1; +- } +- size = (ssize_t) r; ++ size = r; + } + else { + nbdkit_error ("unknown parameter '%s'", key); +@@ -89,7 +85,7 @@ pattern_open (int readonly) + static int64_t + pattern_get_size (void *handle) + { +- return (int64_t) size; ++ return size; + } + + #define MIN(a, b) ((a) < (b) ? (a) : (b)) +@@ -102,7 +98,7 @@ pattern_pread (void *handle, void *buf, uint32_t count, uint64_t offset, + char *b = buf; + uint64_t d; + uint64_t o; +- size_t n; ++ uint32_t n; + + while (count > 0) { + d = htobe64 (offset & ~7); +diff --git a/plugins/random/random.c b/plugins/random/random.c +index 185609d..8adc26e 100644 +--- a/plugins/random/random.c ++++ b/plugins/random/random.c +@@ -45,7 +45,7 @@ + #include + + /* The size of disk in bytes (initialized by size= parameter). */ +-static size_t size = 0; ++static int64_t size = 0; + + /* Seed. */ + static uint32_t seed; +@@ -95,11 +95,7 @@ random_config (const char *key, const char *value) + r = nbdkit_parse_size (value); + if (r == -1) + return -1; +- if (r > SIZE_MAX) { +- nbdkit_error ("size > SIZE_MAX"); +- return -1; +- } +- size = (ssize_t) r; ++ size = r; + } + else { + nbdkit_error ("unknown parameter '%s'", key); +@@ -129,7 +125,7 @@ random_open (int readonly) + static int64_t + random_get_size (void *handle) + { +- return (int64_t) size; ++ return size; + } + + /* Read data. */ +@@ -137,7 +133,7 @@ static int + random_pread (void *handle, void *buf, uint32_t count, uint64_t offset, + uint32_t flags) + { +- size_t i; ++ uint32_t i; + unsigned char *b = buf; + uint32_t s; + +-- +2.17.1 + diff --git a/nbdkit.spec b/nbdkit.spec index aafa58f..03be5e6 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -44,6 +44,8 @@ Patch0007: 0007-tests-Test-largest-possible-plugin-size.patch Patch0008: 0008-docs-Fix-broken-cross-reference-in-man-page.patch Patch0009: 0009-docs-Break-up-some-over-long-lines-in-documentation.patch Patch0010: 0010-docs-Add-podwrapper-from-libguestfs.patch +Patch0011: 0011-Rework-README-file.patch +Patch0012: 0012-null-pattern-random-Make-these-plugins-work-on-32-bi.patch %global patches_touch_autotools 1 %if 0%{patches_touch_autotools} @@ -778,6 +780,7 @@ popd * Sun Jul 15 2018 Richard W.M. Jones - 1.5.0-3 - Add all upstream patches since 1.5.0. - New pattern plugin. +- Add fixes for 32 bit platforms i686 and armv7. * Fri Jul 13 2018 Fedora Release Engineering - 1.5.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild