Bug 279450 - devel/py-libzfs: patches needed for -current to make it compile with a newer libzfs
Summary: devel/py-libzfs: patches needed for -current to make it compile with a newer ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Ryan Moeller
URL:
Keywords:
Depends on:
Blocks: 269298
  Show dependency treegraph
 
Reported: 2024-06-01 11:42 UTC by Alexander Leidinger
Modified: 2024-07-09 17:42 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (freqlabs)


Attachments
1st patch (356 bytes, patch)
2024-06-01 11:42 UTC, Alexander Leidinger
no flags Details | Diff
2nd patch (587 bytes, patch)
2024-06-01 11:43 UTC, Alexander Leidinger
no flags Details | Diff
patch-to-upgrade (1.33 KB, patch)
2024-06-08 16:18 UTC, Kurt Jaeger
no flags Details | Diff
check libzfs.h using grep (1.91 KB, patch)
2024-06-18 20:18 UTC, Hiroo Ono
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Leidinger freebsd_committer freebsd_triage 2024-06-01 11:42:58 UTC
Created attachment 251134 [details]
1st patch
Comment 1 Alexander Leidinger freebsd_committer freebsd_triage 2024-06-01 11:43:29 UTC
Created attachment 251135 [details]
2nd patch
Comment 2 geoffroy desvernay 2024-06-02 17:26:16 UTC
should'n this change be conditionnal to openzfs version >= 2.2.4 only (or it may break current stable releases) ?
Comment 3 geoffroy desvernay 2024-06-02 17:32:57 UTC
seems this is included upstream:
https://github.com/truenas/py-libzfs/commit/b5ffe1f1d6097df6e2f5cc6dd3c968872ec60804
Comment 4 Alexander Leidinger freebsd_committer freebsd_triage 2024-06-02 20:40:35 UTC
(In reply to geoffroy desvernay from comment #2)
No idea which version introduced this change, or how to handle it in cpython.
Comment 5 Kurt Jaeger freebsd_committer freebsd_triage 2024-06-08 16:18:55 UTC
Created attachment 251292 [details]
patch-to-upgrade

see attachment, updates the upstream -- at least it builds.
Comment 6 Kurt Jaeger freebsd_committer freebsd_triage 2024-06-08 17:17:56 UTC
(In reply to Kurt Jaeger from comment #5)
ok, only on 15, not on 14.1. So not a suitable patch 8-(
Comment 7 Kurt Jaeger freebsd_committer freebsd_triage 2024-06-08 17:18:47 UTC
Comment on attachment 251292 [details]
patch-to-upgrade

does not build on other than current.
Comment 8 Hiroo Ono 2024-06-18 16:48:02 UTC
On main (-current), the API change was introduced by the commmit 	783d3ff6d7fae619db8a7990b8a6387de0c677b5 dated 2024-03-30. The nearest __FreeBSD_version bump  is dated on 2024-04-06 to 1500018.
https://cgit.freebsd.org/src/commit/sys/contrib/openzfs/include/libzfs.h?id=783d3ff6d7fae619db8a7990b8a6387de0c677b5
https://cgit.freebsd.org/src/commit/sys/sys/param.h?id=0192eda105b367d4670205547e8e830e3716bea3

On stable/14, this change was introduced the commit 	9a5f0cb5b639f8e0435103d44b17eb8a352af990 dated on 2024-05-03. The nearest __FreeBSD_version bump is dated on 2024-06-04 to 1401501. (Or, on 2024-04-20 to 1401500.)
https://cgit.freebsd.org/src/commit/sys/contrib/openzfs/lib/libzfs?h=stable/14&id=9a5f0cb5b639f8e0435103d44b17eb8a352af990

So, there should be such lines in the port's Makefile:

.include <bsd.port.options.mk>

.if ${OPSYS} == FreeBSD && (${OSVERSION} >= 1500018 || (${OSVERSION} >= 1401501 && ${OSVERSION} < 1500000))
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-libzfs.pyx ¥
        ${PATCHDIR}/extra-patch-libzfs.h  # the patch file should be generated appropriately
.endif

There remains a short window that the port does not build, but I do not know other methods.
Comment 9 Hiroo Ono 2024-06-18 17:04:50 UTC
(In reply to Hiroo Ono from comment #8)

> There remains a short window that the port does not build, but I do not know other methods.

${GREP} ... /usr/include/libzfs.h && ${REINPLACE_CMD} ... ${WRKSRC}/.../libzfs.pyx && {REINPLACE_CMD} ... ${WRKSRC}/.../libzfs.pxd

may work, but it may be overkill.
Comment 10 Hiroo Ono 2024-06-18 20:18:04 UTC
Created attachment 251549 [details]
check libzfs.h using grep

Check /usr/include/libzfs.h if zpool_add has the newer prototype and patch.
Tested on 13.3-STABLE 1303500 77814c9599 and 14.1-STABLE 1401500 a7abf88b47.
Comment 11 Joakim Bergman 2024-06-26 14:56:30 UTC
(In reply to Hiroo Ono from comment #10)

I have applied this patch locally and can confirm it works on my machine (where I had issues without this patch). I'm on FreeBSD 14.1.
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-07-08 14:04:36 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=26eecc68d56b64a3299a565569809ec387fa4b19

commit 26eecc68d56b64a3299a565569809ec387fa4b19
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-07-08 14:03:01 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-07-08 14:03:44 +0000

    devel/py-libzfs: Unbreak on FreeBSD 15 by pulling a patch from upstream

    PR:             279450

 devel/py-libzfs/Makefile                          |  4 +++
 devel/py-libzfs/files/extra-zpool-add.patch (new) | 44 +++++++++++++++++++++++
 2 files changed, 48 insertions(+)
Comment 13 Gleb Popov freebsd_committer freebsd_triage 2024-07-08 14:11:58 UTC
Missed the

Approved by: freqlabs (maintainer timeout)

line in the commit message.
Comment 14 Hiroo Ono 2024-07-08 20:27:34 UTC
.if ${OSVERSION} >= 1500000
is wrong. please see comment No.8.
Comment 15 commit-hook freebsd_committer freebsd_triage 2024-07-09 17:41:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=38cc769ee806e95985981189cd7987fd3f41db99

commit 38cc769ee806e95985981189cd7987fd3f41db99
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-07-09 17:40:13 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-07-09 17:41:08 +0000

    devel/py-libzfs: Make the OSVERSION check more accurate

    PR:             279450
    Reported by:    Hiroo Ono <hiroo.ono+freebsd@gmail.com>

 devel/py-libzfs/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 16 Gleb Popov freebsd_committer freebsd_triage 2024-07-09 17:42:21 UTC
Yes, thank you. I had to adjust the 1401 case a bit, though.