On 28/11/2026 15:08, Jonathan Armani wrote:
Lightly tested on amd64.

I have tested on amd64 and arm64 with ntfs3g partitions and native windows images (XP era) and it looks quite fine. No crash, even with purposely corrupted images.

OK renaud@


Regen patches and improve groupmember while there:
- add a header comment like the other systems
- use kvm_getprocs instead of raw sysctl as it retries when the
table grows and does not leak
- improve the loop condition by swapping the && operands

Also drop --enable-mount-helper as mkfs.ntfs and mount.* are Linux
names and the mount.* links were installed outside PREFIX

diff --git sysutils/ntfs-3g/Makefile sysutils/ntfs-3g/Makefile
index 42a55f349..44e5d608f 100644
--- sysutils/ntfs-3g/Makefile
+++ sysutils/ntfs-3g/Makefile
@@ -1,11 +1,11 @@
  COMMENT =     FUSE NTFS driver with read/write support
-V = 2026.2.25
+V =            2026.11.23
DISTNAME = ntfs-3g_ntfsprogs-${V}
  WRKDIST =     ${WRKDIR}/ntfs-3g-${V}
  PKGNAME =     ntfs_3g-${V}
-SHARED_LIBS += ntfs-3g         1.0     # 89.0
+SHARED_LIBS += ntfs-3g         2.0     # 92.0
  CATEGORIES =  sysutils
HOMEPAGE = https://www.tuxera.com/company/open-source/
@@ -15,7 +15,7 @@ MAINTAINER =  Helg Bredow <[email protected]>
  # GPLv2
  PERMIT_PACKAGE =      Yes
-WANTLIB += c execinfo uuid fuse>=4 pthread
+WANTLIB += c execinfo uuid fuse>=4 kvm pthread
SITES = https://tuxera.com/opensource/
  EXTRACT_SUFX =        .tgz
@@ -29,7 +29,6 @@ CONFIGURE_ENV =               
CPPFLAGS="-I${LOCALBASE}/include" \
  CONFIGURE_ARGS =      --disable-ldconfig \
                        --disable-mtab \
                        --enable-extras \
-                       --enable-mount-helper \
                        --with-fuse=external
post-install:
diff --git sysutils/ntfs-3g/distinfo sysutils/ntfs-3g/distinfo
index 4c6f2254e..21e19ff02 100644
--- sysutils/ntfs-3g/distinfo
+++ sysutils/ntfs-3g/distinfo
@@ -1,2 +1,2 @@
-SHA256 (ntfs-3g_ntfsprogs-2026.2.25.tgz) = 
d1Tzsy6Lr5xHJFm06cmB464PUDkQfN2NggGu0KlJAIo=
-SIZE (ntfs-3g_ntfsprogs-2026.2.25.tgz) = 1337883
+SHA256 (ntfs-3g_ntfsprogs-2026.11.23.tgz) = 
gn+QmVXEwq5Un0MWF97QDnU63Np+L+taM9cJBOWhl8k=
+SIZE (ntfs-3g_ntfsprogs-2026.11.23.tgz) = 1351110
diff --git sysutils/ntfs-3g/patches/patch-configure 
sysutils/ntfs-3g/patches/patch-configure
index 88e1b49cd..32a8372dc 100644
--- sysutils/ntfs-3g/patches/patch-configure
+++ sysutils/ntfs-3g/patches/patch-configure
@@ -1,7 +1,7 @@
  Index: configure
  --- configure.orig
  +++ configure
-@@ -15281,7 +15281,7 @@ esac
+@@ -15880,7 +15880,7 @@ esac
   fi
;;
diff --git sysutils/ntfs-3g/patches/patch-libntfs-3g_Makefile_in 
sysutils/ntfs-3g/patches/patch-libntfs-3g_Makefile_in
index cdeb1bb2e..1523710dc 100644
--- sysutils/ntfs-3g/patches/patch-libntfs-3g_Makefile_in
+++ sysutils/ntfs-3g/patches/patch-libntfs-3g_Makefile_in
@@ -1,7 +1,16 @@
  Index: libntfs-3g/Makefile.in
  --- libntfs-3g/Makefile.in.orig
  +++ libntfs-3g/Makefile.in
-@@ -1169,15 +1169,9 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local
+@@ -433,7 +433,7 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+ @INSTALL_LIBRARY_FALSE@noinst_LTLIBRARIES = libntfs-3g.la
+ libntfs_3g_la_CFLAGS = $(AM_CFLAGS)
+ libntfs_3g_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBNTFS_CPPFLAGS) 
-I$(top_srcdir)/include/ntfs-3g
+-libntfs_3g_la_LIBADD = $(LIBNTFS_LIBS)
++libntfs_3g_la_LIBADD = $(LIBNTFS_LIBS) -lkvm
+ libntfs_3g_la_LDFLAGS = -version-info $(LIBNTFS_3G_VERSION) -no-undefined
+ libntfs_3g_la_SOURCES = acls.c attrib.c attrlist.c bitmap.c bootsect.c \
+       cache.c collate.c compat.c compress.c debug.c device.c dir.c \
+@@ -1172,15 +1172,9 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local
   # We may need to move .so files to root
   # And create ldscript or symbolic link from /usr
   install-exec-hook: install-rootlibLTLIBRARIES
diff --git sysutils/ntfs-3g/patches/patch-libntfs-3g_mft_c 
sysutils/ntfs-3g/patches/patch-libntfs-3g_mft_c
index 86ad78c46..0e27e6310 100644
--- sysutils/ntfs-3g/patches/patch-libntfs-3g_mft_c
+++ sysutils/ntfs-3g/patches/patch-libntfs-3g_mft_c
@@ -14,7 +14,7 @@ Index: libntfs-3g/mft.c
   #ifdef HAVE_STDLIB_H
   #include <stdlib.h>
   #endif
-@@ -522,9 +525,28 @@ static int ntfs_is_mft(ntfs_inode *ni)
+@@ -530,9 +533,28 @@ static int ntfs_is_mft(ntfs_inode *ni)
        return 0;
   }
@@ -45,15 +45,15 @@ Index: libntfs-3g/mft.c #define RESERVED_MFT_RECORDS 64 -@@ -550,6 +572,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *
-       s64 pass_end, ll, data_pos, pass_start, ofs, bit;
+@@ -560,6 +582,7 @@ static s64 ntfs_mft_bitmap_find_free_rec(ntfs_volume *
+       s64 ret = -1;
        ntfs_attr *mftbmp_na;
        u8 *buf, *byte;
  +     long page_size;
-       unsigned int size;
        u8 pass, b;
-       int ret = -1;
-@@ -561,7 +584,8 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *
+
+       ntfs_log_enter("Entering\n");
+@@ -569,7 +592,8 @@ static s64 ntfs_mft_bitmap_find_free_rec(ntfs_volume *
         * Set the end of the pass making sure we do not overflow the mft
         * bitmap.
         */
@@ -63,7 +63,7 @@ Index: libntfs-3g/mft.c
        pass_end = vol->mft_na->allocated_size >> vol->mft_record_size_bits;
        ll = mftbmp_na->initialized_size << 3;
        if (pass_end > ll)
-@@ -587,7 +611,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *
+@@ -595,7 +619,7 @@ static s64 ntfs_mft_bitmap_find_free_rec(ntfs_volume *
                pass = 2;
        }
        pass_start = data_pos;
@@ -72,9 +72,9 @@ Index: libntfs-3g/mft.c
        if (!buf)
                goto leave;
        
-@@ -600,7 +624,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *
+@@ -608,7 +632,7 @@ static s64 ntfs_mft_bitmap_find_free_rec(ntfs_volume *
        b = 0;
- #endif
+
        /* Loop until a free mft record is found. */
  -     for (; pass <= 2; size = PAGE_SIZE) {
  +     for (; pass <= 2; size = page_size) {
diff --git sysutils/ntfs-3g/patches/patch-libntfs-3g_security_c 
sysutils/ntfs-3g/patches/patch-libntfs-3g_security_c
index 34cbfbf0a..114cb9327 100644
--- sysutils/ntfs-3g/patches/patch-libntfs-3g_security_c
+++ sysutils/ntfs-3g/patches/patch-libntfs-3g_security_c
@@ -1,18 +1,20 @@
  Index: libntfs-3g/security.c
  --- libntfs-3g/security.c.orig
  +++ libntfs-3g/security.c
-@@ -44,6 +44,10 @@
+@@ -44,6 +44,12 @@
   #ifdef HAVE_SYS_STAT_H
   #include <sys/stat.h>
   #endif
  +#ifdef __OpenBSD__
  +#include <sys/sysctl.h>
  +#include <sys/types.h>
++#include <kvm.h>
++#include <limits.h>
  +#endif
#include <unistd.h>
   #include <pwd.h>
-@@ -1225,6 +1229,68 @@ static BOOL groupmember(struct SECURITY_CONTEXT *scx,
+@@ -1240,6 +1246,55 @@ static BOOL groupmember(struct SECURITY_CONTEXT *scx,
                close(fd);
                }
        }
@@ -21,63 +23,50 @@ Index: libntfs-3g/security.c
  +
  +#elif defined(__OpenBSD__)
  +
++/*
++ *            Check whether current thread owner is member of file group
++ *                            OpenBSD version
++ *    Should not be called for user root, however the group may be root
++ *
++ * The group list is available from kvm_getprocs(3) and fuse
++ * supplies the TID as the caller pid, so search the threads.
++ *
++ */
++
  +static BOOL groupmember(struct SECURITY_CONTEXT *scx, uid_t uid, gid_t gid)
  +{
++      char errbuf[_POSIX2_LINE_MAX];
  +     struct kinfo_proc *kp;
-+      size_t size;
-+      int mib[6];
-+      int ip, ig;
-+      int pcnt;
-+      gid_t *g;
-+      pid_t tid;
++      kvm_t *kd;
++      int ip, ig, pcnt;
  +     BOOL ismember;
  +
  +     if (scx->vol->secure_flags & (1 << SECURITY_STATICGRPS))
-+              ismember = staticgroupmember(scx, uid, gid);
-+      else {
-+              ismember = FALSE; /* default return */
-+              tid = scx->tid;
-+              mib[0] = CTL_KERN;
-+              mib[1] = KERN_PROC;
-+              mib[2] = KERN_PROC_ALL | KERN_PROC_SHOW_THREADS;
-+              mib[3] = 0;
-+              mib[4] = sizeof(struct kinfo_proc);
-+              mib[5] = 0;
-+              if (sysctl(mib, 6, NULL, &size, NULL, 0) == -1)
-+                      ntfs_log_error("Could not get size of process table: "
-+                          "%s\n", strerror(errno));
-+              else {
-+                      mib[5] = size / sizeof(struct kinfo_proc);
-+                      kp = malloc(size);
-+                      if ((kp == NULL) ||
-+                          (sysctl(mib, 6, kp, &size, NULL, 0) == -1))
-+                              ntfs_log_error("Could not get process table: "
-+                                  "%s\n", strerror(errno));
-+                      else {
-+                              pcnt = size / sizeof(struct kinfo_proc);
-+                              ip = 0;
-+                              while ((kp[ip].p_tid != tid) && (ip < pcnt))
-+                                      ip++;
++              return (staticgroupmember(scx, uid, gid));
  +
-+                              if (ip < pcnt) {
-+                                      if (kp[ip].p_gid == gid)
-+                                              ismember = TRUE;
-+                                      g = kp[ip].p_groups;
-+                                      ig = 0;
-+                                      while (!ismember
-+                                          && (ig < kp[ip].p_ngroups)
-+                                          && (*g != gid)) {
-+                                              ig++;
-+                                              g++;
-+                                      }
-+                                      if (ig < kp[ip].p_ngroups)
-+                                              ismember = TRUE;
-+                              }
-+                              free(kp);
-+                      }
++      ismember = FALSE; /* default return */
++      kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
++      if (kd == NULL) {
++              ntfs_log_error("kvm_openfiles: %s\n", errbuf);
++              return (ismember);
++      }
++      kp = kvm_getprocs(kd, KERN_PROC_ALL | KERN_PROC_SHOW_THREADS, 0,
++          sizeof(*kp), &pcnt);
++      if (kp == NULL)
++              ntfs_log_error("kvm_getprocs: %s\n", kvm_geterr(kd));
++      else {
++              for (ip = 0; ip < pcnt && kp[ip].p_tid != scx->tid; ip++)
++                      ;
++              if (ip < pcnt) {
++                      if (kp[ip].p_gid == gid)
++                              ismember = TRUE;
++                      for (ig = 0; !ismember && ig < kp[ip].p_ngroups &&
++                          ig < KI_NGROUPS; ig++)
++                              if (kp[ip].p_groups[ig] == gid)
++                                      ismember = TRUE;
  +             }
  +     }
-+
++      kvm_close(kd);
        return (ismember);
   }
diff --git sysutils/ntfs-3g/patches/patch-src_Makefile_in sysutils/ntfs-3g/patches/patch-src_Makefile_in
index ca60d01e4..b8e4d0cdd 100644
--- sysutils/ntfs-3g/patches/patch-src_Makefile_in
+++ sysutils/ntfs-3g/patches/patch-src_Makefile_in
@@ -1,7 +1,7 @@
  Index: src/Makefile.in
  --- src/Makefile.in.orig
  +++ src/Makefile.in
-@@ -544,7 +544,7 @@ install-rootbinPROGRAMS: $(rootbin_PROGRAMS)
+@@ -543,7 +543,7 @@ install-rootbinPROGRAMS: $(rootbin_PROGRAMS)
            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
            test -z "$$files" || { \
            echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files 
'$(DESTDIR)$(rootbindir)$$dir'"; \
@@ -10,12 +10,3 @@ Index: src/Makefile.in
            } \
        ; done
-@@ -999,7 +999,7 @@ uninstall-man: uninstall-man8
-
- @ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@install-exec-local:    
install-rootbinPROGRAMS
- @ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@       $(MKDIR_P) 
"$(DESTDIR)/sbin"
--@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@       $(LN_S) -f 
"$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
-+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@       $(LN_S) -f 
"$(DESTDIR)/sbin/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
- @ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@       $(LN_S) -f 
"$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
-
- @ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@install-data-local:    
install-man8
diff --git sysutils/ntfs-3g/pkg/PLIST sysutils/ntfs-3g/pkg/PLIST
index bc9a7bec3..80054b464 100644
--- sysutils/ntfs-3g/pkg/PLIST
+++ sysutils/ntfs-3g/pkg/PLIST
@@ -56,10 +56,7 @@ include/ntfs-3g/xattrs.h
  lib/libntfs-3g.la
  @lib lib/libntfs-3g.so.${LIBntfs-3g_VERSION}
  lib/pkgconfig/libntfs-3g.pc
-@man man/man8/mkfs.ntfs.8
  @man man/man8/mkntfs.8
-@man man/man8/mount.lowntfs-3g.8
-@man man/man8/mount.ntfs-3g.8
  @man man/man8/ntfs-3g.8
  @man man/man8/ntfs-3g.probe.8
  @man man/man8/ntfscat.8
@@ -81,7 +78,6 @@ lib/pkgconfig/libntfs-3g.pc
  @man man/man8/ntfsundelete.8
  @man man/man8/ntfsusermap.8
  @man man/man8/ntfswipe.8
-sbin/mkfs.ntfs
  @bin sbin/mkntfs
  @bin sbin/ntfsclone
  @bin sbin/ntfscp


Reply via email to