"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: convert imsg->fd to imsg_get_fd()
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 17 Jan 2024 12:58:01 +0100

Download raw body.

Thread
On Wed, Jan 17, 2024 at 12:01:06PM +0100, Omar Polo wrote:
> Oh, this also means that got can't be built on the latest release.

The main branch already fails to build on 7.4 now.

I would like to preserve our ability to provide -stable packages on 7.4.
Is the hack below too horrible or can we use this until 7.5?

-----------------------------------------------
 provide imsg_get_fd in case libutil does not provide it
 
 This hack is needed to keep providing -stable packages for OpenBSD 7.4.
 It can be dropped once the 7.5 release is out.
 
diff cfcfb026c8c94bb60b400f6b21b89bce7b698873 9151cb94da06fc2eda68f4dde3388aa05de4ffd3
commit - cfcfb026c8c94bb60b400f6b21b89bce7b698873
commit + 9151cb94da06fc2eda68f4dde3388aa05de4ffd3
blob - 495bc5a1d44efc6d760792f0976a4cbf808e0b8a
blob + 9445083e58321d06a302cdb23136923329e029fd
--- Makefile.inc
+++ Makefile.inc
@@ -6,6 +6,12 @@ CPPFLAGS += -DGOT_LIBEXECDIR=${LIBEXECDIR} -DGOT_VERSI
 #CFLAGS += -DGOT_DELTA_CACHE_DEBUG
 #CFLAGS += -DGOT_DIFF_NO_MMAP
 
+# Compat hack for OpenBSD 7.4. Can be removed once 7.5 has been released.
+GOT_NEED_IMSG_GET_FD != if nm /usr/lib/libutil.a | grep -q imsg_get_fd; then echo 'No'; else echo 'Yes'; fi
+.if "${GOT_NEED_IMSG_GET_FD}" == "Yes"
+CFLAGS += -DGOT_NEED_IMSG_GET_FD
+.endif
+
 .if "${GOT_RELEASE}" == "Yes"
 PREFIX ?= /usr/local
 BINDIR ?= ${PREFIX}/bin
blob - d517f36f2ccbda4c48348016a20e6d6e87fbd1a4
blob + 26d623ff4b67f9c7e13bd0a0f8dd4178d57687f9
--- lib/got_lib_privsep.h
+++ lib/got_lib_privsep.h
@@ -839,3 +839,7 @@ const struct got_error *got_privsep_recv_painted_commi
     struct imsgbuf *);
 
 void got_privsep_exec_child(int[2], const char *, const char *);
+
+#ifdef GOT_NEED_IMSG_GET_FD
+int imsg_get_fd(struct imsg *);
+#endif
blob - f0f625ddad473f4c65fabd04e165b109d87dacb7
blob + edd86a7772bb2102629d74a5f25ca2850c24d315
--- lib/privsep.c
+++ lib/privsep.c
@@ -3615,3 +3615,12 @@ got_privsep_exec_child(int imsg_fds[2], const char *pa
 		_exit(1);
 	}
 }
+
+/* backwards compat for OpenBSD 7.4 release */
+#ifdef GOT_NEED_IMSG_GET_FD
+int
+imsg_get_fd(struct imsg *imsg)
+{
+	return (imsg->fd);
+}
+#endif