git: 5db803a6f269 - main - sysutils/e2fsprogs: misc/e2fsprogs-libblkid: fixes

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sat, 01 Oct 2022 10:45:56 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5db803a6f26956fb47a211c29e34a0e5ccd82286

commit 5db803a6f26956fb47a211c29e34a0e5ccd82286
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-10-01 10:40:13 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-10-01 10:45:34 +0000

    sysutils/e2fsprogs: misc/e2fsprogs-libblkid: fixes
    
    - for libblkid, fix a buffer size when parsing device names
      to make room for a trailing '\0' character from sscanf().
      (This was a long-standing bug in our local patch.)
    
    - patch out qsort_r redeclarations from the sort_r library that are
      incompatible with FreeBSD since it aligned with GNU qsort_r() API
    
    - remove FreeBSD 14-CURRENT BROKEN= tag.
    
    Related to:
    PR:             266227
---
 misc/e2fsprogs-libblkid/Makefile                   |  2 +-
 sysutils/e2fsprogs/Makefile                        |  6 +-----
 sysutils/e2fsprogs/files/patch-lib_blkid_devname.c |  4 ++--
 .../e2fsprogs/files/patch-lib_support_sort__r.h    | 24 ++++++++++++++++++++++
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/misc/e2fsprogs-libblkid/Makefile b/misc/e2fsprogs-libblkid/Makefile
index 5380a8921476..8dfd267d7a05 100644
--- a/misc/e2fsprogs-libblkid/Makefile
+++ b/misc/e2fsprogs-libblkid/Makefile
@@ -1,4 +1,4 @@
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	misc devel
 PKGNAMESUFFIX=	-libblkid
 
diff --git a/sysutils/e2fsprogs/Makefile b/sysutils/e2fsprogs/Makefile
index 31381058a529..87a1e2cb7836 100644
--- a/sysutils/e2fsprogs/Makefile
+++ b/sysutils/e2fsprogs/Makefile
@@ -13,7 +13,7 @@
 
 PORTNAME=	e2fsprogs
 PORTVERSION=	1.46.5
-PORTREVISION?=	3
+PORTREVISION?=	4
 CATEGORIES?=	sysutils
 MASTER_SITES=	KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
 
@@ -142,10 +142,6 @@ USE_PERL5=	build
 
 .include <bsd.port.pre.mk>
 
-.if ${MASTERDIR} == ${.CURDIR} && ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400072
-BROKEN=		incompatible qsort_r() API. Upstream working on a autoconf-based fix.
-.endif
-
 .if ${PORT_OPTIONS:MNLS}
 . if empty(ICONV_LIB)
 libintl=	${LOCALBASE}/lib/libintl.a
diff --git a/sysutils/e2fsprogs/files/patch-lib_blkid_devname.c b/sysutils/e2fsprogs/files/patch-lib_blkid_devname.c
index 220b03b9ba72..9a59112ed239 100644
--- a/sysutils/e2fsprogs/files/patch-lib_blkid_devname.c
+++ b/sysutils/e2fsprogs/files/patch-lib_blkid_devname.c
@@ -58,7 +58,7 @@
 +		}
 +	}
 +	char *str = buf;
-+	while (line = strsep(&str, "\n")) {
++	while ((line = strsep(&str, "\n"))) {
 +#endif /* __FreeBSD__ */
  		last = which;
  		which ^= 1;
@@ -70,7 +70,7 @@
  			continue;
  		devs[which] = makedev(ma, mi);
 +#else
-+		char type[5];
++		char type[6];
 +		int dummy;
  
 +		if (sscanf(line, "%*d %5s %128[^ ] %lld %d",
diff --git a/sysutils/e2fsprogs/files/patch-lib_support_sort__r.h b/sysutils/e2fsprogs/files/patch-lib_support_sort__r.h
new file mode 100644
index 000000000000..499a385bc1a3
--- /dev/null
+++ b/sysutils/e2fsprogs/files/patch-lib_support_sort__r.h
@@ -0,0 +1,24 @@
+--- lib/support/sort_r.h.orig	2021-12-30 05:54:33 UTC
++++ lib/support/sort_r.h
+@@ -234,10 +234,6 @@ static _SORT_R_INLINE void sort_r_simple(void *base, s
+ 
+   #if defined _SORT_R_BSD
+ 
+-    /* Ensure qsort_r is defined */
+-    extern void qsort_r(void *base, size_t nel, size_t width, void *thunk,
+-                        int (*compar)(void *_thunk,
+-                                      const void *_a, const void *_b));
+ 
+   #endif
+ 
+@@ -262,10 +258,6 @@ static _SORT_R_INLINE void sort_r_simple(void *base, s
+ 
+   #if defined _SORT_R_LINUX
+ 
+-    typedef int(* __compar_d_fn_t)(const void *, const void *, void *);
+-    extern void qsort_r(void *base, size_t nel, size_t width,
+-                        __compar_d_fn_t __compar, void *arg)
+-      __attribute__((nonnull (1, 4)));
+ 
+   #endif
+