NetBSD Problem Report #60822

From zakinko@snowrabbit.org  Tue Sep 29 07:35:55 2026
Return-Path: <zakinko@snowrabbit.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 21CA71A923B
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 29 Sep 2026 07:35:55 +0000 (UTC)
Message-Id: <20260929073552.27C93C92A0@bambi.snowrabbit.org>
Date: Tue, 29 Sep 2026 16:35:52 +0900 (JST)
From: zakinko@snowrabbit.org
Reply-To: zakinko@snowrabbit.org
To: gnats-bugs@NetBSD.org
Cc: zakinko@snowrabbit.org
Subject: pkgsrc: devel/glib2 does not build on DragonFly
X-Send-Pr-Version: 3.95
X-From4GNATS: "zakinko@snowrabbit.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60822
>Category:       pkg
>Synopsis:       pkgsrc: devel/glib2 does not build on DragonFly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 29 07:40:00 +0000 2026
>Originator:     Showta Ishizaki
>Release:        pkgsrc as of 2026-09-29, devel/glib2 at glib2-2.90.0nb1
>Organization:
>Environment:
System: DragonFly 6.4.2 x86_64
>Description:
	g_unix_fd_query_path() in glib/glib-unix.c puts DragonFly in the
	same branch as FreeBSD, which uses fcntl(F_KINFO) and struct
	kinfo_file.  DragonFly has neither, so the file does not compile:

	  ../glib/glib-unix.c:972:10: error: variable 'kf' has initializer but incomplete type
	  ../glib/glib-unix.c:975:18: error: 'F_KINFO' undeclared (first use in this function); did you mean 'SIGINFO'?

	DragonFly has had fcntl(F_GETPATH) since 6.0 (kernel commit
	36f3145a09, "kernel - Add fcntl(F_GETPATH)").  It fills a
	MAXPATHLEN buffer the same way as on macOS, NetBSD and OpenBSD, so
	DragonFly belongs in that branch.  Upstream main still has the same
	code.

>How-To-Repeat:
	Build devel/glib2 on DragonFly.

>Fix:
	The diff below extends the tree's patch-glib_glib-unix.c and keeps
	its NetBSD hunks as they are.  It applies to today's pkgsrc-current
	without fuzz, and the new patch applies to the pristine 2.90.0
	source without fuzz as well.

	With it, devel/glib2 and security/polkit build and install on
	DragonFly 6.4.2.  The change only moves __DragonFly__ from one
	#elif to the other, so every other system compiles the same code
	as before.

	Diff against pkgsrc-current of 2026-09-29:

	Index: devel/glib2/distinfo
	--- devel/glib2/distinfo	2026-09-29 16:03:09
	+++ devel/glib2/distinfo	2026-09-29 16:03:09
	@@ -17,7 +17,7 @@
	 SHA1 (patch-glib_gatomic.c) = 5d08e19cc1c2557a5c007af8b368968217ce65b0
	 SHA1 (patch-glib_gatomic.h) = d1c39c3594a5c89d196349e5eafb5512795f55f8
	 SHA1 (patch-glib_genviron.c) = 45e382a4b5412c69b310fd26482eff6faffa2c0d
	-SHA1 (patch-glib_glib-unix.c) = 1c7ef6437680317f5e28c3e75bca26cfec48351f
	+SHA1 (patch-glib_glib-unix.c) = c5c247cdc39b46ce550eb9c98b2d59dde65f3154
	 SHA1 (patch-glib_gspawn-posix.c) = cc5789c94aaaa3b0c586f882bd948610912019d1
	 SHA1 (patch-glib_gthread.c) = 52cedcf40ad82af9b9f45315aacf63a8abd93fd5
	 SHA1 (patch-glib_tests_hash.c) = a7e19ca55fcbbc0b188c34755cae5b6b65b67f1a
	Index: devel/glib2/patches/patch-glib_glib-unix.c
	--- devel/glib2/patches/patch-glib_glib-unix.c	2026-09-29 16:03:09
	+++ devel/glib2/patches/patch-glib_glib-unix.c	2026-09-29 16:03:09
	@@ -1,7 +1,13 @@
	 $NetBSD: patch-glib_glib-unix.c,v 1.2 2026/04/24 08:02:58 mrg Exp $

	-Fix build on NetBSD.
	+Fix build on NetBSD and DragonFly.

	+g_unix_fd_query_path() sends DragonFly down the FreeBSD branch, which
	+uses fcntl(F_KINFO) and struct kinfo_file.  DragonFly has neither, so
	+glib-unix.c does not compile there.  DragonFly has had fcntl(F_GETPATH)
	+since 6.0, used the same way as on macOS, NetBSD and OpenBSD, so move
	+it to that branch.
	+
	 --- glib/glib-unix.c.orig	2026-03-16 06:53:50.000000000 -0700
	 +++ glib/glib-unix.c	2026-04-24 00:41:49.040268939 -0700
	 @@ -49,6 +49,7 @@
	@@ -12,15 +18,27 @@
	  #include <sys/types.h>
	  #include <pwd.h>
	  #include <unistd.h>
	-@@ -983,6 +984,7 @@ g_unix_fd_query_path (int      fd,
	+@@ -967,7 +968,7 @@
	+   g_free (proc_path);

	+   return g_steal_pointer (&path);
	+-#elif defined (__FreeBSD__) || defined(__DragonFly__)
	++#elif defined (__FreeBSD__)
	+   struct kinfo_file kf = {0};
	+ 
	+   kf.kf_structsize = sizeof (kf);
	+@@ -982,7 +983,9 @@
	+     }
	+ 
	    return g_strdup (kf.kf_path);
	- #elif defined (__APPLE__) || defined (__NetBSD__) || defined (__OpenBSD__)
	+-#elif defined (__APPLE__) || defined (__NetBSD__) || defined (__OpenBSD__)
	++#elif defined (__APPLE__) || defined (__NetBSD__) || defined (__OpenBSD__) || \
	++      defined (__DragonFly__)
	 +# ifdef F_GETPATH
	    char file_path[MAXPATHLEN] = {0};

	    if (fcntl (fd, F_GETPATH, file_path) < 0)
	-@@ -996,6 +998,11 @@ g_unix_fd_query_path (int      fd,
	+@@ -996,6 +999,11 @@
	      }

	    return g_strdup (file_path);

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.