Monday, January 30, 2023

sysutils/ntfs-3g and clang 15 (was: Re: amd64-clang bulk build report)

(+cc folks who expressed interest in the most recent update)

On Mon, Jan 30 2023, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
> On Mon, Jan 30 2023, jca@wxcvbn.org wrote:
>> Bulk build on pbuild-amd64.wxcvbn.org

[...]

>> https://wxcvbn.org/~jca/build-failures/amd64-clang/2023-01-24/sysutils/ntfs-3g.txt

Here's a diff that lets ntfs-3g build with clang 15. The statfs code
is used to provide better diagnostics but can't work as intended on
OpenBSD since struct statvfs doesn't provide the f_type member. Also
that f_type field is compared against magic values from the Linux
kernel. And using f_fstypename (a string) as done currently doesn't
work either; and clang 15 notices and errors out about pointer vs
integer type mismatches.

ok?

llvm 15 test material (a few days behind -current):
amd64 snapshots (mesa 22.3.3): https://pbuild-amd64.wxcvbn.org/pub/OpenBSD/snapshots/amd64/
git branch: https://github.com/jcourreges/openbsd-src/tree/llvm15-7


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/sysutils/ntfs-3g/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- Makefile 23 Jun 2022 13:47:09 -0000 1.18
+++ Makefile 27 Jan 2023 19:53:38 -0000
@@ -1,6 +1,7 @@
COMMENT = FUSE NTFS driver with read/write support

V = 2022.5.17
+REVISION = 0
DISTNAME = ntfs-3g_ntfsprogs-${V}
PKGNAME = ntfs_3g-${V}
SHARED_LIBS += ntfs-3g 1.0 # 89.0
Index: patches/patch-ntfsprogs_ntfsclone_c
===================================================================
RCS file: /home/cvs/ports/sysutils/ntfs-3g/patches/patch-ntfsprogs_ntfsclone_c,v
retrieving revision 1.6
diff -u -p -r1.6 patch-ntfsprogs_ntfsclone_c
--- patches/patch-ntfsprogs_ntfsclone_c 23 Jun 2022 13:47:09 -0000 1.6
+++ patches/patch-ntfsprogs_ntfsclone_c 27 Jan 2023 19:53:22 -0000
@@ -1,21 +1,16 @@
+As noted in the comment our struct statvfs doesn't have f_type so the checks
+performed are meaningless on OpenBSD. They're comparisons against hardcoded
+magic values anyway. While here, fix the | vs || mismatch.
+
Index: ntfsprogs/ntfsclone.c
--- ntfsprogs/ntfsclone.c.orig
+++ ntfsprogs/ntfsclone.c
-@@ -852,7 +852,7 @@ static void copy_cluster(int rescue, u64 rescue_lcn, u
- #ifndef NO_STATFS
- int err = errno;
- perr_printf("Write failed");
-- if (err == EIO && opt.stfs.f_type == 0x517b)
-+ if (err == EIO && opt.stfs.f_fstypename == 0x517b)
- Printf("Apparently you tried to clone to a remote "
- "Windows computer but they don't\nhave "
- "efficient sparse file handling by default. "
-@@ -2312,7 +2312,7 @@ static void set_filesize(s64 filesize)
- Printf("WARNING: Couldn't get filesystem type: "
- "%s\n", strerror(errno));
- else
-- fs_type = opt.stfs.f_type;
-+ fs_type = opt.stfs.f_fstypename;
+@@ -105,7 +105,7 @@
+ #undef HAVE_WINDOWS_H
+

No comments:

Post a Comment