[Buildroot] [git commit] package/zfs: don't download patch generated from github

Yann E. MORIN yann.morin.1998 at free.fr
Sun Nov 26 16:19:36 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=2c3946fcb45b07db5cc88cdc944745aa1ef8fa04
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Git-generated patches embed the short-hash of the objects in the
repository. The length of those short hashes are subject to change
in at least three cases:

  - the number of objects in the repository increases, so git increases
    the length of short hashes to get a good change there is no
    collision;

  - the git configuration changes, see core.abbrev in git-config;

  - the heuristic to compute the length changes in a newer git version.

Since the bump to zfs 2.1.4 in commit 68dfd09708c6, the patch generated
by github has changed, causing download failures:

    wget --passive-ftp -nd -t 3 -O '/home/ymorin/dev/buildroot/O/master/build/.bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch.uoFq9e/output' 'https://github.com/openzfs/zfs/commit/bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch'
    --2023-11-26 16:53:25--
    https://github.com/openzfs/zfs/commit/bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch
    Resolving github.com (github.com)... 140.82.121.3
    Connecting to github.com (github.com)|140.82.121.3|:443...  connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 2976 (2.9K) [text/plain]
    Saving to: ‘/home/ymorin/dev/buildroot/O/master/build/.bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch.uoFq9e/output’

    /home/ymorin/dev/buildroot/O/ 100%[================================================>]   2.91K --.-KB/s in 0s

    2023-11-26 16:53:25 (15.0 MB/s) - ‘/home/ymorin/dev/buildroot/O/master/build/.bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch.uoFq9e/output’ saved [2976/2976]

    ERROR: while checking hashes from package/zfs//zfs.hash
    ERROR: bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch has wrong sha256 hash:
    ERROR: expected: 96a27353fe717ff2c8b95deb8b009c4eb750303c6400e2d8a2582ab1ec12b25a
    ERROR: got     : 246c80f66abca5a7e0c41cc7c56eec0b4cb7f16b142262480401142bbc2f999f
    ERROR: Incomplete download, or man-in-the-middle (MITM) attack

And indeed, the length of short hashes has increased by one since then.

Fix that by bundling the patch, with the short hashes that were known
then, so that it matches the sha256 we had for it.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/zfs/0001-config-user-check-for-aio.h.patch | 94 ++++++++++++++++++++++
 package/zfs/zfs.hash                               |  1 -
 package/zfs/zfs.mk                                 |  3 +-
 3 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/package/zfs/0001-config-user-check-for-aio.h.patch b/package/zfs/0001-config-user-check-for-aio.h.patch
new file mode 100644
index 0000000000..55321ee2fc
--- /dev/null
+++ b/package/zfs/0001-config-user-check-for-aio.h.patch
@@ -0,0 +1,94 @@
+From bc3f12bfac152a0c28951cec92340ba14f9ccee9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli at nabijaczleweli.xyz>
+Date: Mon, 28 Mar 2022 19:24:22 +0200
+Subject: [PATCH] config: user: check for <aio.h>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+And always zpool_read_label_slow() on non-conformant libcs
+
+Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
+Co-authored-by: José Luis Salvador Rufo <salvador.joseluis at gmail.com>
+Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli at nabijaczleweli.xyz>
+Closes #13207
+Closes #13254
+Upstream: https://github.com/openzfs/zfs/commit/bc3f12bfac152a0c28951cec92340ba14f9ccee9
+[yann.morin.1998 at free.fr: backport from upstream]
+Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
+---
+ config/user-aio.h.m4        | 7 +++++++
+ config/user-libaio.m4       | 2 +-
+ config/user.m4              | 1 +
+ lib/libzutil/zutil_import.c | 6 ++++++
+ 4 files changed, 15 insertions(+), 1 deletion(-)
+ create mode 100644 config/user-aio.h.m4
+
+diff --git a/config/user-aio.h.m4 b/config/user-aio.h.m4
+new file mode 100644
+index 00000000000..152c0946722
+--- /dev/null
++++ b/config/user-aio.h.m4
+@@ -0,0 +1,7 @@
++dnl #
++dnl # POSIX specifies <aio.h> as part of realtime extensions,
++dnl # and is missing from at least uClibc – force fallbacks there
++dnl #
++AC_DEFUN([ZFS_AC_CONFIG_USER_AIO_H], [
++	ZFS_AC_FIND_SYSTEM_LIBRARY(AIO_H, [], [aio.h], [], [rt], [lio_listio])
++])
+diff --git a/config/user-libaio.m4 b/config/user-libaio.m4
+index 95c144d76b4..8009bd11b3e 100644
+--- a/config/user-libaio.m4
++++ b/config/user-libaio.m4
+@@ -1,5 +1,5 @@
+ dnl #
+-dnl # Check for libaio - only used for libaiot test cases.
++dnl # Check for libaio - only used for mmap_libaio test cases.
+ dnl #
+ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
+ 	ZFS_AC_FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no])
+diff --git a/config/user.m4 b/config/user.m4
+index 670820b3771..f450af47e04 100644
+--- a/config/user.m4
++++ b/config/user.m4
+@@ -23,6 +23,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
+ 	ZFS_AC_CONFIG_USER_LIBAIO
+ 	ZFS_AC_CONFIG_USER_LIBATOMIC
+ 	ZFS_AC_CONFIG_USER_LIBFETCH
++	ZFS_AC_CONFIG_USER_AIO_H
+ 	ZFS_AC_CONFIG_USER_CLOCK_GETTIME
+ 	ZFS_AC_CONFIG_USER_PAM
+ 	ZFS_AC_CONFIG_USER_RUNSTATEDIR
+diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c
+index d7547c4249e..3744a1c3474 100644
+--- a/lib/libzutil/zutil_import.c
++++ b/lib/libzutil/zutil_import.c
+@@ -47,7 +47,9 @@
+  * using our derived config, and record the results.
+  */
+
++#ifdef HAVE_AIO_H
+ #include <aio.h>
++#endif
+ #include <ctype.h>
+ #include <dirent.h>
+ #include <errno.h>
+@@ -982,6 +984,9 @@ zpool_read_label_slow(int fd, nvlist_t **config, int *num_labels)
+ int
+ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
+ {
++#ifndef HAVE_AIO_H
++	return (zpool_read_label_slow(fd, config, num_labels));
++#else
+ 	struct stat64 statbuf;
+ 	struct aiocb aiocbs[VDEV_LABELS];
+ 	struct aiocb *aiocbps[VDEV_LABELS];
+@@ -1104,6 +1109,7 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
+ 	*config = expected_config;
+
+ 	return (0);
++#endif
+ }
+
+ /*
diff --git a/package/zfs/zfs.hash b/package/zfs/zfs.hash
index 3a73e5e94f..f0327ce8cc 100644
--- a/package/zfs/zfs.hash
+++ b/package/zfs/zfs.hash
@@ -1,6 +1,5 @@
 # From https://github.com/openzfs/zfs/releases/download/zfs-2.1.12/zfs-2.1.12.sha256.asc
 sha256  64daa26aed3e12c931f6f4413d7527c4ebdb8da35416b356152b5f9fdd4c6e6d  zfs-2.1.12.tar.gz
-sha256  96a27353fe717ff2c8b95deb8b009c4eb750303c6400e2d8a2582ab1ec12b25a  bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch
 
 # Hash for license files:
 sha256  1ffb70c33c4f79f04e947facc5c7851f289609256aacb47fc115f700427d9520  LICENSE
diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
index f0461ea9ec..6ea3d22ba5 100644
--- a/package/zfs/zfs.mk
+++ b/package/zfs/zfs.mk
@@ -6,14 +6,13 @@
 
 ZFS_VERSION = 2.1.12
 ZFS_SITE = https://github.com/openzfs/zfs/releases/download/zfs-$(ZFS_VERSION)
-ZFS_PATCH = https://github.com/openzfs/zfs/commit/bc3f12bfac152a0c28951cec92340ba14f9ccee9.patch
 ZFS_SELINUX_MODULES = zfs
 ZFS_LICENSE = CDDL
 ZFS_LICENSE_FILES = LICENSE COPYRIGHT
 ZFS_CPE_ID_VENDOR = openzfs
 ZFS_CPE_ID_PRODUCT = openzfs
 
-# 0001-removal-of-LegacyVersion-broke-ax_python_dev.m4.patch
+# 0001-config-user-check-for-aio.h.patch
 ZFS_AUTORECONF = YES
 
 ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib libcurl linux



More information about the buildroot mailing list