On Thu, Aug 27, 2026 at 11:16:33AM +0000, Johannes Thyssen Tishman wrote:
> Thanks for pointing this out. Without the fs_test.c patch, kyua-testers
> doesn't build on OpenBSD:
> 
> ld: error: undefined symbol: lchmod
> >>> referenced by fs_test.c
> >>>               fs_test-fs_test.o:(lchmod_fails)
> 
> So my guess is that fs_test.c was patched such that the port would
> compile, but lchmod wasn't patched out completely. The error bapt
> mentions in the issue comes from fs.c:261 (try_unprotect_symlink()),
> which is thrown because HAVE_WORKING_LCHMOD isn't defined. This can be
> seen in the configure logs:
> 
> checking for a working lchmod... no
> 

Ah, indeed. Now it makes sense.

> I suppose we could use a stub with fchmodat()?

Yes. Something like this should work:

 
M  devel/kyua-testers/Makefile            |   1+  1-
A  devel/kyua-testers/patches/patch-fs_c  |  27+  0-

2 files changed, 28 insertions(+), 1 deletion(-)

commit - 1e8bf14cdb87644d9384c7d00703bf9afc4fa796
commit + 4d0bd63cc9f9e253126cdafc92059302e76287c9
blob - c34c6b7706ff888f92b9168712d2bc99a487cd4e
blob + 754ade6415b1750605ba1aadb012f0495ab2a513
--- devel/kyua-testers/Makefile
+++ devel/kyua-testers/Makefile
@@ -1,6 +1,6 @@
 COMMENT =              scriptable interfaces to interact with test programs
 DISTNAME =             kyua-testers-0.2
-REVISION =             1
+REVISION =             2
 
 CATEGORIES =           devel
 HOMEPAGE =             https://github.com/jmmv/kyua
blob - /dev/null
blob + 08c9b78c50bafa7aba3d1e850abc26c93ce59b9f (mode 644)
--- /dev/null
+++ devel/kyua-testers/patches/patch-fs_c
@@ -0,0 +1,27 @@
+- we do not have lchmod
+Index: fs.c
+--- fs.c.orig
++++ fs.c
+@@ -41,6 +41,7 @@
+ 
+ #include <assert.h>
+ #include <dirent.h>
++#include <fcntl.h>
+ #include <err.h>
+ #include <errno.h>
+ #include <stdarg.h>
+@@ -258,8 +259,12 @@ try_unprotect_symlink(const char* path)
+     } else
+         return true;
+ #else
+-    warnx("lchmod(%s, %04o) failed; system call not implemented", path,
+-          new_mode);
++    /* Simulate lchmod via fchmodat */
++    if (fchmodat(AT_FDCWD, path, new_mode, AT_SYMLINK_NOFOLLOW) == -1) {
++        warnx("lchmod(%s, %04o) failed", path, new_mode);
++        return false;
++    } else
++        return true;
+     return false;
+ #endif
+ }

Reply via email to