From 5a32a7777a068f073c4c3de5a353533939306643 Mon Sep 17 00:00:00 2001 From: Christian Weisgerber Date: Fri, 26 Apr 2024 15:07:20 +0000 Subject: devel/got: switch to got-portable 0.98.2 This is a long overdue change from a homegrown compatibility layer to the got-portable release. No functional changes are expected. --- devel/got/Makefile | 25 +- devel/got/distinfo | 6 +- devel/got/files/openbsd-compat/Makefile | 13 - devel/got/files/openbsd-compat/endian.h | 6 - devel/got/files/openbsd-compat/freezero.c | 27 - devel/got/files/openbsd-compat/getdtablecount.c | 57 -- devel/got/files/openbsd-compat/imsg-buffer.c | 699 --------------------- devel/got/files/openbsd-compat/imsg.c | 450 ------------- devel/got/files/openbsd-compat/imsg.h | 158 ----- devel/got/files/openbsd-compat/openbsd-compat.h | 28 - devel/got/files/openbsd-compat/recallocarray.c | 82 --- devel/got/files/openbsd-compat/sha1.h | 14 - devel/got/files/openbsd-compat/sha2.h | 11 - devel/got/files/openbsd-compat/siphash.c | 181 ------ devel/got/files/openbsd-compat/siphash.h | 83 --- devel/got/files/openbsd-compat/util.h | 19 - devel/got/files/patch-Makefile | 8 - devel/got/files/patch-Makefile.in | 11 + devel/got/files/patch-Makefile.inc | 28 - devel/got/files/patch-configure | 15 + devel/got/files/patch-got_Makefile | 11 - devel/got/files/patch-gotadmin_Makefile | 11 - devel/got/files/patch-libexec_Makefile.inc | 12 - .../patch-libexec_got-fetch-pack_got-fetch-pack.c | 22 - .../patch-libexec_got-index-pack_got-index-pack.c | 22 - .../patch-libexec_got-read-blob_got-read-blob.c | 22 - ...patch-libexec_got-read-commit_got-read-commit.c | 22 - ...libexec_got-read-gitconfig_got-read-gitconfig.c | 22 - ...libexec_got-read-gotconfig_got-read-gotconfig.c | 22 - ...patch-libexec_got-read-object_got-read-object.c | 22 - .../patch-libexec_got-read-pack_got-read-pack.c | 22 - .../patch-libexec_got-read-patch_got-read-patch.c | 22 - .../patch-libexec_got-read-tag_got-read-tag.c | 22 - .../patch-libexec_got-read-tree_got-read-tree.c | 22 - .../patch-libexec_got-send-pack_got-send-pack.c | 22 - devel/got/files/patch-regress_Makefile | 9 - devel/got/files/patch-regress_cmdline_Makefile | 10 - devel/got/files/patch-regress_delta_Makefile | 12 - devel/got/files/patch-regress_deltify_Makefile | 12 - devel/got/files/patch-regress_fetch_Makefile | 12 - devel/got/files/patch-regress_idset_Makefile | 12 - devel/got/files/patch-regress_path_Makefile | 12 - devel/got/files/patch-regress_tog_Makefile | 10 - devel/got/files/patch-tog_Makefile | 11 - 44 files changed, 34 insertions(+), 2285 deletions(-) delete mode 100644 devel/got/files/openbsd-compat/Makefile delete mode 100644 devel/got/files/openbsd-compat/endian.h delete mode 100644 devel/got/files/openbsd-compat/freezero.c delete mode 100644 devel/got/files/openbsd-compat/getdtablecount.c delete mode 100644 devel/got/files/openbsd-compat/imsg-buffer.c delete mode 100644 devel/got/files/openbsd-compat/imsg.c delete mode 100644 devel/got/files/openbsd-compat/imsg.h delete mode 100644 devel/got/files/openbsd-compat/openbsd-compat.h delete mode 100644 devel/got/files/openbsd-compat/recallocarray.c delete mode 100644 devel/got/files/openbsd-compat/sha1.h delete mode 100644 devel/got/files/openbsd-compat/sha2.h delete mode 100644 devel/got/files/openbsd-compat/siphash.c delete mode 100644 devel/got/files/openbsd-compat/siphash.h delete mode 100644 devel/got/files/openbsd-compat/util.h delete mode 100644 devel/got/files/patch-Makefile create mode 100644 devel/got/files/patch-Makefile.in delete mode 100644 devel/got/files/patch-Makefile.inc create mode 100644 devel/got/files/patch-configure delete mode 100644 devel/got/files/patch-got_Makefile delete mode 100644 devel/got/files/patch-gotadmin_Makefile delete mode 100644 devel/got/files/patch-libexec_Makefile.inc delete mode 100644 devel/got/files/patch-libexec_got-fetch-pack_got-fetch-pack.c delete mode 100644 devel/got/files/patch-libexec_got-index-pack_got-index-pack.c delete mode 100644 devel/got/files/patch-libexec_got-read-blob_got-read-blob.c delete mode 100644 devel/got/files/patch-libexec_got-read-commit_got-read-commit.c delete mode 100644 devel/got/files/patch-libexec_got-read-gitconfig_got-read-gitconfig.c delete mode 100644 devel/got/files/patch-libexec_got-read-gotconfig_got-read-gotconfig.c delete mode 100644 devel/got/files/patch-libexec_got-read-object_got-read-object.c delete mode 100644 devel/got/files/patch-libexec_got-read-pack_got-read-pack.c delete mode 100644 devel/got/files/patch-libexec_got-read-patch_got-read-patch.c delete mode 100644 devel/got/files/patch-libexec_got-read-tag_got-read-tag.c delete mode 100644 devel/got/files/patch-libexec_got-read-tree_got-read-tree.c delete mode 100644 devel/got/files/patch-libexec_got-send-pack_got-send-pack.c delete mode 100644 devel/got/files/patch-regress_Makefile delete mode 100644 devel/got/files/patch-regress_cmdline_Makefile delete mode 100644 devel/got/files/patch-regress_delta_Makefile delete mode 100644 devel/got/files/patch-regress_deltify_Makefile delete mode 100644 devel/got/files/patch-regress_fetch_Makefile delete mode 100644 devel/got/files/patch-regress_idset_Makefile delete mode 100644 devel/got/files/patch-regress_path_Makefile delete mode 100644 devel/got/files/patch-regress_tog_Makefile delete mode 100644 devel/got/files/patch-tog_Makefile diff --git a/devel/got/Makefile b/devel/got/Makefile index 3ea370244689..93cd039e5e42 100644 --- a/devel/got/Makefile +++ b/devel/got/Makefile @@ -1,7 +1,8 @@ PORTNAME= got -DISTVERSION= 0.98 +DISTVERSION= 0.98.2 CATEGORIES= devel -MASTER_SITES= https://gameoftrees.org/releases/ +MASTER_SITES= https://gameoftrees.org/releases/portable/ +DISTNAME= got-portable-${DISTVERSION} MAINTAINER= naddy@FreeBSD.org COMMENT= Game of Trees version control system @@ -10,27 +11,11 @@ WWW= https://gameoftrees.org LICENSE= ISCL LICENSE_FILE= ${WRKSRC}/LICENCE -USES= localbase:ldflags uidfix +USES= localbase ssl CONFLICTS_INSTALL= p5-App-GitGot -# Insert #include "openbsd-compat.h" into each source file, -# after the <...> includes and before the "..." ones. -n= ${.newline} -post-extract: - @${FIND} ${WRKSRC} -name '*.[cy]' -exec \ - ${REINPLACE_CMD} '1,/^#include "/{ \ - /^#include "/i\$n#include "openbsd-compat.h"\$n$n}' \ - {} + - ${CP} -R ${FILESDIR}/openbsd-compat ${WRKSRC} - -# The regression test suite requires: -# installed got -# installed git -# installed perl and HTTP::Daemon -# ssh to 127.0.0.1 -regress: - @(cd ${WRKSRC}/regress && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} regress) +GNU_CONFIGURE= Yes .include diff --git a/devel/got/distinfo b/devel/got/distinfo index b9e3f9a5be79..3be8904d6fb5 100644 --- a/devel/got/distinfo +++ b/devel/got/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1713879270 -SHA256 (got-0.98.tar.gz) = 1ff7ec010b62413afb3e88d57ea52e67788b2ccbd2078ad0156df73c099759da -SIZE (got-0.98.tar.gz) = 971797 +TIMESTAMP = 1714082661 +SHA256 (got-portable-0.98.2.tar.gz) = ff5d4ad9922edf1c8055b2398650972fd463c809590dbe78e2eab1bf78a150c8 +SIZE (got-portable-0.98.2.tar.gz) = 1351206 diff --git a/devel/got/files/openbsd-compat/Makefile b/devel/got/files/openbsd-compat/Makefile deleted file mode 100644 index ab835f0c4285..000000000000 --- a/devel/got/files/openbsd-compat/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -LIB= openbsd-compat -INTERNALLIB= - -SRCS= freezero.c \ - getdtablecount.c \ - imsg.c \ - imsg-buffer.c \ - recallocarray.c \ - siphash.c - -CFLAGS+= -I${.CURDIR} - -.include diff --git a/devel/got/files/openbsd-compat/endian.h b/devel/got/files/openbsd-compat/endian.h deleted file mode 100644 index 4da84f324eb7..000000000000 --- a/devel/got/files/openbsd-compat/endian.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _OPENBSD_COMPAT_ENDIAN_H_ -#define _OPENBSD_COMPAT_ENDIAN_H_ - -#include - -#endif diff --git a/devel/got/files/openbsd-compat/freezero.c b/devel/got/files/openbsd-compat/freezero.c deleted file mode 100644 index d2938666c4f0..000000000000 --- a/devel/got/files/openbsd-compat/freezero.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include - -void freezero(void *, size_t); - -void -freezero(void *ptr, size_t sz) -{ - explicit_bzero(ptr, sz); - free(ptr); -} diff --git a/devel/got/files/openbsd-compat/getdtablecount.c b/devel/got/files/openbsd-compat/getdtablecount.c deleted file mode 100644 index 0d1f158ffa3d..000000000000 --- a/devel/got/files/openbsd-compat/getdtablecount.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2015 Craig Rodrigues - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#include -#include -#include - -int getdtablecount(void); - -/* - * Return the count of open file descriptors for this process. - * - */ -int -getdtablecount(void) -{ - int mib[4]; - int error; - int nfds; - size_t len; - - len = sizeof(nfds); - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_NFDS; - mib[3] = 0; - - error = sysctl(mib, 4, &nfds, &len, NULL, 0); - if (error) - return (-1); - return (nfds); -} diff --git a/devel/got/files/openbsd-compat/imsg-buffer.c b/devel/got/files/openbsd-compat/imsg-buffer.c deleted file mode 100644 index 5c874fc56002..000000000000 --- a/devel/got/files/openbsd-compat/imsg-buffer.c +++ /dev/null @@ -1,699 +0,0 @@ -/* $OpenBSD: imsg-buffer.c,v 1.18 2023/12/12 15:47:41 claudio Exp $ */ - -/* - * Copyright (c) 2023 Claudio Jeker - * Copyright (c) 2003, 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "imsg.h" - -static int ibuf_realloc(struct ibuf *, size_t); -static void ibuf_enqueue(struct msgbuf *, struct ibuf *); -static void ibuf_dequeue(struct msgbuf *, struct ibuf *); -static void msgbuf_drain(struct msgbuf *, size_t); - -struct ibuf * -ibuf_open(size_t len) -{ - struct ibuf *buf; - - if (len == 0) { - errno = EINVAL; - return (NULL); - } - if ((buf = calloc(1, sizeof(struct ibuf))) == NULL) - return (NULL); - if ((buf->buf = calloc(len, 1)) == NULL) { - free(buf); - return (NULL); - } - buf->size = buf->max = len; - buf->fd = -1; - - return (buf); -} - -struct ibuf * -ibuf_dynamic(size_t len, size_t max) -{ - struct ibuf *buf; - - if (max == 0 || max < len) { - errno = EINVAL; - return (NULL); - } - - if ((buf = calloc(1, sizeof(struct ibuf))) == NULL) - return (NULL); - if (len > 0) { - if ((buf->buf = calloc(len, 1)) == NULL) { - free(buf); - return (NULL); - } - } - buf->size = len; - buf->max = max; - buf->fd = -1; - - return (buf); -} - -static int -ibuf_realloc(struct ibuf *buf, size_t len) -{ - unsigned char *b; - - /* on static buffers max is eq size and so the following fails */ - if (len > SIZE_MAX - buf->wpos || buf->wpos + len > buf->max) { - errno = ERANGE; - return (-1); - } - - b = recallocarray(buf->buf, buf->size, buf->wpos + len, 1); - if (b == NULL) - return (-1); - buf->buf = b; - buf->size = buf->wpos + len; - - return (0); -} - -void * -ibuf_reserve(struct ibuf *buf, size_t len) -{ - void *b; - - if (len > SIZE_MAX - buf->wpos || buf->max == 0) { - errno = ERANGE; - return (NULL); - } - - if (buf->wpos + len > buf->size) - if (ibuf_realloc(buf, len) == -1) - return (NULL); - - b = buf->buf + buf->wpos; - buf->wpos += len; - return (b); -} - -int -ibuf_add(struct ibuf *buf, const void *data, size_t len) -{ - void *b; - - if ((b = ibuf_reserve(buf, len)) == NULL) - return (-1); - - memcpy(b, data, len); - return (0); -} - -int -ibuf_add_ibuf(struct ibuf *buf, const struct ibuf *from) -{ - return ibuf_add(buf, ibuf_data(from), ibuf_size(from)); -} - -/* remove after tree is converted */ -int -ibuf_add_buf(struct ibuf *buf, const struct ibuf *from) -{ - return ibuf_add_ibuf(buf, from); -} - -int -ibuf_add_n8(struct ibuf *buf, uint64_t value) -{ - uint8_t v; - - if (value > UINT8_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return ibuf_add(buf, &v, sizeof(v)); -} - -int -ibuf_add_n16(struct ibuf *buf, uint64_t value) -{ - uint16_t v; - - if (value > UINT16_MAX) { - errno = EINVAL; - return (-1); - } - v = htobe16(value); - return ibuf_add(buf, &v, sizeof(v)); -} - -int -ibuf_add_n32(struct ibuf *buf, uint64_t value) -{ - uint32_t v; - - if (value > UINT32_MAX) { - errno = EINVAL; - return (-1); - } - v = htobe32(value); - return ibuf_add(buf, &v, sizeof(v)); -} - -int -ibuf_add_n64(struct ibuf *buf, uint64_t value) -{ - value = htobe64(value); - return ibuf_add(buf, &value, sizeof(value)); -} - -int -ibuf_add_h16(struct ibuf *buf, uint64_t value) -{ - uint16_t v; - - if (value > UINT16_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return ibuf_add(buf, &v, sizeof(v)); -} - -int -ibuf_add_h32(struct ibuf *buf, uint64_t value) -{ - uint32_t v; - - if (value > UINT32_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return ibuf_add(buf, &v, sizeof(v)); -} - -int -ibuf_add_h64(struct ibuf *buf, uint64_t value) -{ - return ibuf_add(buf, &value, sizeof(value)); -} - -int -ibuf_add_zero(struct ibuf *buf, size_t len) -{ - void *b; - - if ((b = ibuf_reserve(buf, len)) == NULL) - return (-1); - memset(b, 0, len); - return (0); -} - -void * -ibuf_seek(struct ibuf *buf, size_t pos, size_t len) -{ - /* only allow seeking between rpos and wpos */ - if (ibuf_size(buf) < pos || SIZE_MAX - pos < len || - ibuf_size(buf) < pos + len) { - errno = ERANGE; - return (NULL); - } - - return (buf->buf + buf->rpos + pos); -} - -int -ibuf_set(struct ibuf *buf, size_t pos, const void *data, size_t len) -{ - void *b; - - if ((b = ibuf_seek(buf, pos, len)) == NULL) - return (-1); - - memcpy(b, data, len); - return (0); -} - -int -ibuf_set_n8(struct ibuf *buf, size_t pos, uint64_t value) -{ - uint8_t v; - - if (value > UINT8_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return (ibuf_set(buf, pos, &v, sizeof(v))); -} - -int -ibuf_set_n16(struct ibuf *buf, size_t pos, uint64_t value) -{ - uint16_t v; - - if (value > UINT16_MAX) { - errno = EINVAL; - return (-1); - } - v = htobe16(value); - return (ibuf_set(buf, pos, &v, sizeof(v))); -} - -int -ibuf_set_n32(struct ibuf *buf, size_t pos, uint64_t value) -{ - uint32_t v; - - if (value > UINT32_MAX) { - errno = EINVAL; - return (-1); - } - v = htobe32(value); - return (ibuf_set(buf, pos, &v, sizeof(v))); -} - -int -ibuf_set_n64(struct ibuf *buf, size_t pos, uint64_t value) -{ - value = htobe64(value); - return (ibuf_set(buf, pos, &value, sizeof(value))); -} - -int -ibuf_set_h16(struct ibuf *buf, size_t pos, uint64_t value) -{ - uint16_t v; - - if (value > UINT16_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return (ibuf_set(buf, pos, &v, sizeof(v))); -} - -int -ibuf_set_h32(struct ibuf *buf, size_t pos, uint64_t value) -{ - uint32_t v; - - if (value > UINT32_MAX) { - errno = EINVAL; - return (-1); - } - v = value; - return (ibuf_set(buf, pos, &v, sizeof(v))); -} - -int -ibuf_set_h64(struct ibuf *buf, size_t pos, uint64_t value) -{ - return (ibuf_set(buf, pos, &value, sizeof(value))); -} - -void * -ibuf_data(const struct ibuf *buf) -{ - return (buf->buf + buf->rpos); -} - -size_t -ibuf_size(const struct ibuf *buf) -{ - return (buf->wpos - buf->rpos); -} - -size_t -ibuf_left(const struct ibuf *buf) -{ - if (buf->max == 0) - return (0); - return (buf->max - buf->wpos); -} - -int -ibuf_truncate(struct ibuf *buf, size_t len) -{ - if (ibuf_size(buf) >= len) { - buf->wpos = buf->rpos + len; - return (0); - } - if (buf->max == 0) { - /* only allow to truncate down */ - errno = ERANGE; - return (-1); - } - return ibuf_add_zero(buf, len - ibuf_size(buf)); -} - -void -ibuf_rewind(struct ibuf *buf) -{ - buf->rpos = 0; -} - -void -ibuf_close(struct msgbuf *msgbuf, struct ibuf *buf) -{ - ibuf_enqueue(msgbuf, buf); -} - -void -ibuf_from_buffer(struct ibuf *buf, void *data, size_t len) -{ - memset(buf, 0, sizeof(*buf)); - buf->buf = data; - buf->size = buf->wpos = len; - buf->fd = -1; -} - -void -ibuf_from_ibuf(struct ibuf *buf, const struct ibuf *from) -{ - ibuf_from_buffer(buf, ibuf_data(from), ibuf_size(from)); -} - -int -ibuf_get(struct ibuf *buf, void *data, size_t len) -{ - if (ibuf_size(buf) < len) { - errno = EBADMSG; - return (-1); - } - - memcpy(data, ibuf_data(buf), len); - buf->rpos += len; - return (0); -} - -int -ibuf_get_ibuf(struct ibuf *buf, size_t len, struct ibuf *new) -{ - if (ibuf_size(buf) < len) { - errno = EBADMSG; - return (-1); - } - - ibuf_from_buffer(new, ibuf_data(buf), len); - buf->rpos += len; - return (0); -} - -int -ibuf_get_n8(struct ibuf *buf, uint8_t *value) -{ - return ibuf_get(buf, value, sizeof(*value)); -} - -int -ibuf_get_n16(struct ibuf *buf, uint16_t *value) -{ - int rv; - - rv = ibuf_get(buf, value, sizeof(*value)); - *value = be16toh(*value); - return (rv); -} - -int -ibuf_get_n32(struct ibuf *buf, uint32_t *value) -{ - int rv; - - rv = ibuf_get(buf, value, sizeof(*value)); - *value = be32toh(*value); - return (rv); -} - -int -ibuf_get_n64(struct ibuf *buf, uint64_t *value) -{ - int rv; - - rv = ibuf_get(buf, value, sizeof(*value)); - *value = be64toh(*value); - return (rv); -} - -int -ibuf_get_h16(struct ibuf *buf, uint16_t *value) -{ - return ibuf_get(buf, value, sizeof(*value)); -} - -int -ibuf_get_h32(struct ibuf *buf, uint32_t *value) -{ - return ibuf_get(buf, value, sizeof(*value)); -} - -int -ibuf_get_h64(struct ibuf *buf, uint64_t *value) -{ - return ibuf_get(buf, value, sizeof(*value)); -} - -int -ibuf_skip(struct ibuf *buf, size_t len) -{ - if (ibuf_size(buf) < len) { - errno = EBADMSG; - return (-1); - } - - buf->rpos += len; - return (0); -} - -void -ibuf_free(struct ibuf *buf) -{ - if (buf == NULL) - return; - if (buf->max == 0) /* if buf lives on the stack */ - abort(); /* abort before causing more harm */ - if (buf->fd != -1) - close(buf->fd); - freezero(buf->buf, buf->size); - free(buf); -} - -int -ibuf_fd_avail(struct ibuf *buf) -{ - return (buf->fd != -1); -} - -int -ibuf_fd_get(struct ibuf *buf) -{ - int fd; - - fd = buf->fd; - buf->fd = -1; - return (fd); -} - -void -ibuf_fd_set(struct ibuf *buf, int fd) -{ - if (buf->max == 0) /* if buf lives on the stack */ - abort(); /* abort before causing more harm */ - if (buf->fd != -1) - close(buf->fd); - buf->fd = fd; -} - -int -ibuf_write(struct msgbuf *msgbuf) -{ - struct iovec iov[IOV_MAX]; - struct ibuf *buf; - unsigned int i = 0; - ssize_t n; - - memset(&iov, 0, sizeof(iov)); - TAILQ_FOREACH(buf, &msgbuf->bufs, entry) { - if (i >= IOV_MAX) - break; - iov[i].iov_base = ibuf_data(buf); - iov[i].iov_len = ibuf_size(buf); - i++; - } - -again: - if ((n = writev(msgbuf->fd, iov, i)) == -1) { - if (errno == EINTR) - goto again; - if (errno == ENOBUFS) - errno = EAGAIN; - return (-1); - } - - if (n == 0) { /* connection closed */ - errno = 0; - return (0); - } - - msgbuf_drain(msgbuf, n); - - return (1); -} - -void -msgbuf_init(struct msgbuf *msgbuf) -{ - msgbuf->queued = 0; - msgbuf->fd = -1; - TAILQ_INIT(&msgbuf->bufs); -} - -static void -msgbuf_drain(struct msgbuf *msgbuf, size_t n) -{ - struct ibuf *buf, *next; - - for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0; - buf = next) { - next = TAILQ_NEXT(buf, entry); - if (n >= ibuf_size(buf)) { - n -= ibuf_size(buf); - ibuf_dequeue(msgbuf, buf); - } else { - buf->rpos += n; - n = 0; - } - } -} - -void -msgbuf_clear(struct msgbuf *msgbuf) -{ - struct ibuf *buf; - - while ((buf = TAILQ_FIRST(&msgbuf->bufs)) != NULL) - ibuf_dequeue(msgbuf, buf); -} - -int -msgbuf_write(struct msgbuf *msgbuf) -{ - struct iovec iov[IOV_MAX]; - struct ibuf *buf, *buf0 = NULL; - unsigned int i = 0; - ssize_t n; - struct msghdr msg; - struct cmsghdr *cmsg; - union { - struct cmsghdr hdr; - char buf[CMSG_SPACE(sizeof(int))]; - } cmsgbuf; - - memset(&iov, 0, sizeof(iov)); - memset(&msg, 0, sizeof(msg)); - memset(&cmsgbuf, 0, sizeof(cmsgbuf)); - TAILQ_FOREACH(buf, &msgbuf->bufs, entry) { - if (i >= IOV_MAX) - break; - if (i > 0 && buf->fd != -1) - break; - iov[i].iov_base = ibuf_data(buf); - iov[i].iov_len = ibuf_size(buf); - i++; - if (buf->fd != -1) - buf0 = buf; - } - - msg.msg_iov = iov; - msg.msg_iovlen = i; - - if (buf0 != NULL) { - msg.msg_control = (caddr_t)&cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - *(int *)CMSG_DATA(cmsg) = buf0->fd; - } - -again: - if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) { - if (errno == EINTR) - goto again; - if (errno == ENOBUFS) - errno = EAGAIN; - return (-1); - } - - if (n == 0) { /* connection closed */ - errno = 0; - return (0); - } - - /* - * assumption: fd got sent if sendmsg sent anything - * this works because fds are passed one at a time - */ - if (buf0 != NULL) { - close(buf0->fd); - buf0->fd = -1; - } - - msgbuf_drain(msgbuf, n); - - return (1); -} - -uint32_t -msgbuf_queuelen(struct msgbuf *msgbuf) -{ - return (msgbuf->queued); -} - -static void -ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf) -{ - if (buf->max == 0) /* if buf lives on the stack */ - abort(); /* abort before causing more harm */ - TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry); - msgbuf->queued++; -} - -static void -ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf) -{ - TAILQ_REMOVE(&msgbuf->bufs, buf, entry); - msgbuf->queued--; - ibuf_free(buf); -} diff --git a/devel/got/files/openbsd-compat/imsg.c b/devel/got/files/openbsd-compat/imsg.c deleted file mode 100644 index 1340f251727d..000000000000 --- a/devel/got/files/openbsd-compat/imsg.c +++ /dev/null @@ -1,450 +0,0 @@ -/* $OpenBSD: imsg.c,v 1.23 2023/12/12 15:47:41 claudio Exp $ */ - -/* - * Copyright (c) 2023 Claudio Jeker - * Copyright (c) 2003, 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "imsg.h" - -struct imsg_fd { - TAILQ_ENTRY(imsg_fd) entry; - int fd; -}; - -int imsg_fd_overhead = 0; - -static int imsg_dequeue_fd(struct imsgbuf *); - -void -imsg_init(struct imsgbuf *imsgbuf, int fd) -{ - msgbuf_init(&imsgbuf->w); - memset(&imsgbuf->r, 0, sizeof(imsgbuf->r)); - imsgbuf->fd = fd; - imsgbuf->w.fd = fd; - imsgbuf->pid = getpid(); - TAILQ_INIT(&imsgbuf->fds); -} - -ssize_t -imsg_read(struct imsgbuf *imsgbuf) -{ - struct msghdr msg; - struct cmsghdr *cmsg; - union { - struct cmsghdr hdr; - char buf[CMSG_SPACE(sizeof(int) * 1)]; - } cmsgbuf; - struct iovec iov; - ssize_t n = -1; - int fd; - struct imsg_fd *ifd; - - memset(&msg, 0, sizeof(msg)); - memset(&cmsgbuf, 0, sizeof(cmsgbuf)); - - iov.iov_base = imsgbuf->r.buf + imsgbuf->r.wpos; - iov.iov_len = sizeof(imsgbuf->r.buf) - imsgbuf->r.wpos; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - msg.msg_control = &cmsgbuf.buf; - msg.msg_controllen = sizeof(cmsgbuf.buf); - - if ((ifd = calloc(1, sizeof(struct imsg_fd))) == NULL) - return (-1); - -again: - if (getdtablecount() + imsg_fd_overhead + - (int)((CMSG_SPACE(sizeof(int))-CMSG_SPACE(0))/sizeof(int)) - >= getdtablesize()) { - errno = EAGAIN; - free(ifd); - return (-1); - } - - if ((n = recvmsg(imsgbuf->fd, &msg, 0)) == -1) { - if (errno == EINTR) - goto again; - goto fail; - } - - imsgbuf->r.wpos += n; - - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; - cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_RIGHTS) { - int i; - int j; - - /* - * We only accept one file descriptor. Due to C - * padding rules, our control buffer might contain - * more than one fd, and we must close them. - */ - j = ((char *)cmsg + cmsg->cmsg_len - - (char *)CMSG_DATA(cmsg)) / sizeof(int); - for (i = 0; i < j; i++) { - fd = ((int *)CMSG_DATA(cmsg))[i]; - if (ifd != NULL) { - ifd->fd = fd; - TAILQ_INSERT_TAIL(&imsgbuf->fds, ifd, - entry); - ifd = NULL; - } else - close(fd); - } - } - /* we do not handle other ctl data level */ - } - -fail: - free(ifd); - return (n); -} - -ssize_t -imsg_get(struct imsgbuf *imsgbuf, struct imsg *imsg) -{ - struct imsg m; - size_t av, left, datalen; - - av = imsgbuf->r.wpos; - - if (IMSG_HEADER_SIZE > av) - return (0); - - memcpy(&m.hdr, imsgbuf->r.buf, sizeof(m.hdr)); - if (m.hdr.len < IMSG_HEADER_SIZE || - m.hdr.len > MAX_IMSGSIZE) { - errno = ERANGE; - return (-1); - } - if (m.hdr.len > av) - return (0); - - m.fd = -1; - m.buf = NULL; - m.data = NULL; - - datalen = m.hdr.len - IMSG_HEADER_SIZE; - imsgbuf->r.rptr = imsgbuf->r.buf + IMSG_HEADER_SIZE; - if (datalen != 0) { - if ((m.buf = ibuf_open(datalen)) == NULL) - return (-1); - if (ibuf_add(m.buf, imsgbuf->r.rptr, datalen) == -1) { - /* this should never fail */ - ibuf_free(m.buf); - return (-1); - } - m.data = ibuf_data(m.buf); - } - - if (m.hdr.flags & IMSGF_HASFD) - m.fd = imsg_dequeue_fd(imsgbuf); - - if (m.hdr.len < av) { - left = av - m.hdr.len; - memmove(&imsgbuf->r.buf, imsgbuf->r.buf + m.hdr.len, left); - imsgbuf->r.wpos = left; - } else - imsgbuf->r.wpos = 0; - - *imsg = m; - return (datalen + IMSG_HEADER_SIZE); -} - -int -imsg_get_ibuf(struct imsg *imsg, struct ibuf *ibuf) -{ - if (imsg->buf == NULL) { - errno = EBADMSG; - return (-1); - } - return ibuf_get_ibuf(imsg->buf, ibuf_size(imsg->buf), ibuf); -} - -int -imsg_get_data(struct imsg *imsg, void *data, size_t len) -{ - if (len == 0) { - errno = EINVAL; - return (-1); - } - if (imsg->buf == NULL || ibuf_size(imsg->buf) != len) { - errno = EBADMSG; - return (-1); - } - return ibuf_get(imsg->buf, data, len); -} - -int -imsg_get_fd(struct imsg *imsg) -{ - int fd = imsg->fd; - - imsg->fd = -1; - return fd; -} - -uint32_t -imsg_get_id(struct imsg *imsg) -{ - return (imsg->hdr.peerid); -} - -size_t -imsg_get_len(struct imsg *imsg) -{ - if (imsg->buf == NULL) - return 0; - return ibuf_size(imsg->buf); -} - -pid_t -imsg_get_pid(struct imsg *imsg) -{ - return (imsg->hdr.pid); -} - -uint32_t -imsg_get_type(struct imsg *imsg) -{ - return (imsg->hdr.type); -} - -int -imsg_compose(struct imsgbuf *imsgbuf, uint32_t type, uint32_t id, pid_t pid, - int fd, const void *data, size_t datalen) -{ - struct ibuf *wbuf; - - if ((wbuf = imsg_create(imsgbuf, type, id, pid, datalen)) == NULL) - return (-1); - - if (imsg_add(wbuf, data, datalen) == -1) - return (-1); - - ibuf_fd_set(wbuf, fd); - imsg_close(imsgbuf, wbuf); - - return (1); -} - -int -imsg_composev(struct imsgbuf *imsgbuf, uint32_t type, uint32_t id, pid_t pid, - int fd, const struct iovec *iov, int iovcnt) -{ - struct ibuf *wbuf; - int i; - size_t datalen = 0; - - for (i = 0; i < iovcnt; i++) - datalen += iov[i].iov_len; - - if ((wbuf = imsg_create(imsgbuf, type, id, pid, datalen)) == NULL) - return (-1); - - for (i = 0; i < iovcnt; i++) - if (imsg_add(wbuf, iov[i].iov_base, iov[i].iov_len) == -1) - return (-1); - - ibuf_fd_set(wbuf, fd); - imsg_close(imsgbuf, wbuf); - - return (1); -} - -/* - * Enqueue imsg with payload from ibuf buf. fd passing is not possible - * with this function. - */ -int -imsg_compose_ibuf(struct imsgbuf *imsgbuf, uint32_t type, uint32_t id, - pid_t pid, struct ibuf *buf) -{ - struct ibuf *hdrbuf = NULL; - struct imsg_hdr hdr; - int save_errno; - - if (ibuf_size(buf) + IMSG_HEADER_SIZE > MAX_IMSGSIZE) { - errno = ERANGE; - goto fail; - } - - hdr.type = type; - hdr.len = ibuf_size(buf) + IMSG_HEADER_SIZE; - hdr.flags = 0; - hdr.peerid = id; - if ((hdr.pid = pid) == 0) - hdr.pid = imsgbuf->pid; - - if ((hdrbuf = ibuf_open(IMSG_HEADER_SIZE)) == NULL) - goto fail; - if (imsg_add(hdrbuf, &hdr, sizeof(hdr)) == -1) - goto fail; - - ibuf_close(&imsgbuf->w, hdrbuf); - ibuf_close(&imsgbuf->w, buf); - return (1); - - fail: - save_errno = errno; - ibuf_free(buf); - ibuf_free(hdrbuf); - errno = save_errno; - return (-1); -} - -/* - * Forward imsg to another channel. Any attached fd is closed. - */ -int -imsg_forward(struct imsgbuf *imsgbuf, struct imsg *msg) -{ - struct ibuf *wbuf; - size_t len = 0; - - if (msg->fd != -1) { - close(msg->fd); - msg->fd = -1; - } - - if (msg->buf != NULL) { - ibuf_rewind(msg->buf); - len = ibuf_size(msg->buf); - } - - if ((wbuf = imsg_create(imsgbuf, msg->hdr.type, msg->hdr.peerid, - msg->hdr.pid, len)) == NULL) - return (-1); - - if (msg->buf != NULL) { - if (ibuf_add_buf(wbuf, msg->buf) == -1) { - ibuf_free(wbuf); - return (-1); - } - } - - imsg_close(imsgbuf, wbuf); - return (1); -} - -struct ibuf * -imsg_create(struct imsgbuf *imsgbuf, uint32_t type, uint32_t id, pid_t pid, - size_t datalen) -{ - struct ibuf *wbuf; - struct imsg_hdr hdr; - - datalen += IMSG_HEADER_SIZE; - if (datalen > MAX_IMSGSIZE) { - errno = ERANGE; - return (NULL); - } - - hdr.type = type; - hdr.flags = 0; - hdr.peerid = id; - if ((hdr.pid = pid) == 0) - hdr.pid = imsgbuf->pid; - if ((wbuf = ibuf_dynamic(datalen, MAX_IMSGSIZE)) == NULL) { - return (NULL); - } - if (imsg_add(wbuf, &hdr, sizeof(hdr)) == -1) - return (NULL); - - return (wbuf); -} - -int -imsg_add(struct ibuf *msg, const void *data, size_t datalen) -{ - if (datalen) - if (ibuf_add(msg, data, datalen) == -1) { - ibuf_free(msg); - return (-1); - } - return (datalen); -} - -void -imsg_close(struct imsgbuf *imsgbuf, struct ibuf *msg) -{ - struct imsg_hdr *hdr; - - hdr = (struct imsg_hdr *)msg->buf; - - hdr->flags &= ~IMSGF_HASFD; - if (ibuf_fd_avail(msg)) - hdr->flags |= IMSGF_HASFD; - hdr->len = ibuf_size(msg); - - ibuf_close(&imsgbuf->w, msg); -} - -void -imsg_free(struct imsg *imsg) -{ - ibuf_free(imsg->buf); -} - -static int -imsg_dequeue_fd(struct imsgbuf *imsgbuf) -{ - int fd; - struct imsg_fd *ifd; - - if ((ifd = TAILQ_FIRST(&imsgbuf->fds)) == NULL) - return (-1); - - fd = ifd->fd; - TAILQ_REMOVE(&imsgbuf->fds, ifd, entry); - free(ifd); - - return (fd); -} - -int -imsg_flush(struct imsgbuf *imsgbuf) -{ - while (imsgbuf->w.queued) - if (msgbuf_write(&imsgbuf->w) <= 0) - return (-1); - return (0); -} - -void -imsg_clear(struct imsgbuf *imsgbuf) -{ - int fd; - - msgbuf_clear(&imsgbuf->w); - while ((fd = imsg_dequeue_fd(imsgbuf)) != -1) - close(fd); -} diff --git a/devel/got/files/openbsd-compat/imsg.h b/devel/got/files/openbsd-compat/imsg.h deleted file mode 100644 index dd47b1889da5..000000000000 --- a/devel/got/files/openbsd-compat/imsg.h +++ /dev/null @@ -1,158 +0,0 @@ -/* $OpenBSD: imsg.h,v 1.8 2023/12/12 15:47:41 claudio Exp $ */ - -/* - * Copyright (c) 2023 Claudio Jeker - * Copyright (c) 2006, 2007 Pierre-Yves Ritschard - * Copyright (c) 2006, 2007, 2008 Reyk Floeter - * Copyright (c) 2003, 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _IMSG_H_ -#define _IMSG_H_ - -#include - -#define IBUF_READ_SIZE 65535 -#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr) -#define MAX_IMSGSIZE 16384 - -struct ibuf { - TAILQ_ENTRY(ibuf) entry; - unsigned char *buf; - size_t size; - size_t max; - size_t wpos; - size_t rpos; - int fd; -}; - -struct msgbuf { - TAILQ_HEAD(, ibuf) bufs; - uint32_t queued; - int fd; -}; - -struct ibuf_read { - unsigned char buf[IBUF_READ_SIZE]; - unsigned char *rptr; - size_t wpos; -}; - -struct imsg_fd; -struct imsgbuf { - TAILQ_HEAD(, imsg_fd) fds; - struct ibuf_read r; - struct msgbuf w; - int fd; - pid_t pid; -}; - -#define IMSGF_HASFD 1 - -struct imsg_hdr { - uint32_t type; - uint16_t len; - uint16_t flags; - uint32_t peerid; - uint32_t pid; -}; - -struct imsg { - struct imsg_hdr hdr; - int fd; - void *data; - struct ibuf *buf; -}; - -struct iovec; - -/* imsg-buffer.c */ -struct ibuf *ibuf_open(size_t); -struct ibuf *ibuf_dynamic(size_t, size_t); -int ibuf_add(struct ibuf *, const void *, size_t); -int ibuf_add_buf(struct ibuf *, const struct ibuf *); -int ibuf_add_ibuf(struct ibuf *, const struct ibuf *); -int ibuf_add_zero(struct ibuf *, size_t); -int ibuf_add_n8(struct ibuf *, uint64_t); -int ibuf_add_n16(struct ibuf *, uint64_t); -int ibuf_add_n32(struct ibuf *, uint64_t); -int ibuf_add_n64(struct ibuf *, uint64_t); -int ibuf_add_h16(struct ibuf *, uint64_t); -int ibuf_add_h32(struct ibuf *, uint64_t); -int ibuf_add_h64(struct ibuf *, uint64_t); -void *ibuf_reserve(struct ibuf *, size_t); -void *ibuf_seek(struct ibuf *, size_t, size_t); -int ibuf_set(struct ibuf *, size_t, const void *, size_t); -int ibuf_set_n8(struct ibuf *, size_t, uint64_t); -int ibuf_set_n16(struct ibuf *, size_t, uint64_t); -int ibuf_set_n32(struct ibuf *, size_t, uint64_t); -int ibuf_set_n64(struct ibuf *, size_t, uint64_t); -int ibuf_set_h16(struct ibuf *, size_t, uint64_t); -int ibuf_set_h32(struct ibuf *, size_t, uint64_t); -int ibuf_set_h64(struct ibuf *, size_t, uint64_t); -void *ibuf_data(const struct ibuf *); -size_t ibuf_size(const struct ibuf *); -size_t ibuf_left(const struct ibuf *); -int ibuf_truncate(struct ibuf *, size_t); -void ibuf_rewind(struct ibuf *); -void ibuf_close(struct msgbuf *, struct ibuf *); -void ibuf_from_buffer(struct ibuf *, void *, size_t); -void ibuf_from_ibuf(struct ibuf *, const struct ibuf *); -int ibuf_get(struct ibuf *, void *, size_t); -int ibuf_get_ibuf(struct ibuf *, size_t, struct ibuf *); -int ibuf_get_n8(struct ibuf *, uint8_t *); -int ibuf_get_n16(struct ibuf *, uint16_t *); -int ibuf_get_n32(struct ibuf *, uint32_t *); -int ibuf_get_n64(struct ibuf *, uint64_t *); -int ibuf_get_h16(struct ibuf *, uint16_t *); -int ibuf_get_h32(struct ibuf *, uint32_t *); -int ibuf_get_h64(struct ibuf *, uint64_t *); -int ibuf_skip(struct ibuf *, size_t); -void ibuf_free(struct ibuf *); -int ibuf_fd_avail(struct ibuf *); -int ibuf_fd_get(struct ibuf *); -void ibuf_fd_set(struct ibuf *, int); -int ibuf_write(struct msgbuf *); -void msgbuf_init(struct msgbuf *); -void msgbuf_clear(struct msgbuf *); -uint32_t msgbuf_queuelen(struct msgbuf *); -int msgbuf_write(struct msgbuf *); - -/* imsg.c */ -void imsg_init(struct imsgbuf *, int); -ssize_t imsg_read(struct imsgbuf *); -ssize_t imsg_get(struct imsgbuf *, struct imsg *); -int imsg_get_ibuf(struct imsg *, struct ibuf *); -int imsg_get_data(struct imsg *, void *, size_t); -int imsg_get_fd(struct imsg *); -uint32_t imsg_get_id(struct imsg *); -size_t imsg_get_len(struct imsg *); -pid_t imsg_get_pid(struct imsg *); -uint32_t imsg_get_type(struct imsg *); -int imsg_forward(struct imsgbuf *, struct imsg *); -int imsg_compose(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, - const void *, size_t); -int imsg_composev(struct imsgbuf *, uint32_t, uint32_t, pid_t, int, - const struct iovec *, int); -int imsg_compose_ibuf(struct imsgbuf *, uint32_t, uint32_t, pid_t, - struct ibuf *); -struct ibuf *imsg_create(struct imsgbuf *, uint32_t, uint32_t, pid_t, size_t); -int imsg_add(struct ibuf *, const void *, size_t); -void imsg_close(struct imsgbuf *, struct ibuf *); -void imsg_free(struct imsg *); -int imsg_flush(struct imsgbuf *); -void imsg_clear(struct imsgbuf *); - -#endif diff --git a/devel/got/files/openbsd-compat/openbsd-compat.h b/devel/got/files/openbsd-compat/openbsd-compat.h deleted file mode 100644 index 6fc91966fef1..000000000000 --- a/devel/got/files/openbsd-compat/openbsd-compat.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Compatibility mappings for system headers and - * prototypes for functions in libopenbsd-compat. - */ - -#ifndef _OPENBSD_COMPAT_H_ -#define _OPENBSD_COMPAT_H_ - -/* - * - */ -#define __dead __dead2 - -/* - * - */ -void freezero(void *, size_t); -void *recallocarray(void *, size_t, size_t, size_t); - -/* - * - */ -int getdtablecount(void); - -#define pledge(promises, execpromises) 0 -#define unveil(path, permissions) 0 - -#endif /* _OPENBSD_COMPAT_H_ */ diff --git a/devel/got/files/openbsd-compat/recallocarray.c b/devel/got/files/openbsd-compat/recallocarray.c deleted file mode 100644 index 6fcb1d361b4b..000000000000 --- a/devel/got/files/openbsd-compat/recallocarray.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: recallocarray.c,v 1.2 2021/03/18 11:16:58 claudio Exp $ */ -/* - * Copyright (c) 2008, 2017 Otto Moerbeek - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -void *recallocarray(void *, size_t, size_t, size_t); - -/* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW - */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) - -void * -recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) -{ - size_t oldsize, newsize; - void *newptr; - - if (ptr == NULL) - return calloc(newnmemb, size); - - if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - newnmemb > 0 && SIZE_MAX / newnmemb < size) { - errno = ENOMEM; - return NULL; - } - newsize = newnmemb * size; - - if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - oldnmemb > 0 && SIZE_MAX / oldnmemb < size) { - errno = EINVAL; - return NULL; - } - oldsize = oldnmemb * size; - - /* - * Don't bother too much if we're shrinking just a bit, - * we do not shrink for series of small steps, oh well. - */ - if (newsize <= oldsize) { - size_t d = oldsize - newsize; - - if (d < oldsize / 2 && d < (size_t)getpagesize()) { - memset((char *)ptr + newsize, 0, d); - return ptr; - } - } - - newptr = malloc(newsize); - if (newptr == NULL) - return NULL; - - if (newsize > oldsize) { - memcpy(newptr, ptr, oldsize); - memset((char *)newptr + oldsize, 0, newsize - oldsize); - } else - memcpy(newptr, ptr, newsize); - - explicit_bzero(ptr, oldsize); - free(ptr); - - return newptr; -} diff --git a/devel/got/files/openbsd-compat/sha1.h b/devel/got/files/openbsd-compat/sha1.h deleted file mode 100644 index bfa1dab97f64..000000000000 --- a/devel/got/files/openbsd-compat/sha1.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _OPENBSD_COMPAT_SHA1_H_ -#define _OPENBSD_COMPAT_SHA1_H_ - -#include - -#define SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH -#define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1) - -#define SHA1_CTX SHA_CTX -#define SHA1Init SHA1_Init -#define SHA1Update SHA1_Update -#define SHA1Final SHA1_Final - -#endif diff --git a/devel/got/files/openbsd-compat/sha2.h b/devel/got/files/openbsd-compat/sha2.h deleted file mode 100644 index 28eb07763b8f..000000000000 --- a/devel/got/files/openbsd-compat/sha2.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _OPENBSD_COMPAT_SHA2_H_ -#define _OPENBSD_COMPAT_SHA2_H_ - -#include - -#define SHA2_CTX SHA256_CTX -#define SHA256Init SHA256_Init -#define SHA256Update SHA256_Update -#define SHA256Final SHA256_Final - -#endif diff --git a/devel/got/files/openbsd-compat/siphash.c b/devel/got/files/openbsd-compat/siphash.c deleted file mode 100644 index 755c6659cec0..000000000000 --- a/devel/got/files/openbsd-compat/siphash.c +++ /dev/null @@ -1,181 +0,0 @@ -/* $OpenBSD: siphash.c,v 1.8 2019/01/20 03:53:47 bcook Exp $ */ - -/*- - * Copyright (c) 2013 Andre Oppermann - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * SipHash is a family of PRFs SipHash-c-d where the integer parameters c and d - * are the number of compression rounds and the number of finalization rounds. - * A compression round is identical to a finalization round and this round - * function is called SipRound. Given a 128-bit key k and a (possibly empty) - * byte string m, SipHash-c-d returns a 64-bit value SipHash-c-d(k; m). - * - * Implemented from the paper "SipHash: a fast short-input PRF", 2012.09.18, - * by Jean-Philippe Aumasson and Daniel J. Bernstein, - * Permanent Document ID b9a943a805fbfc6fde808af9fc0ecdfa - * https://131002.net/siphash/siphash.pdf - * https://131002.net/siphash/ - */ - -#include -#include -#include -#include - -static void SipHash_CRounds(SIPHASH_CTX *, int); -static void SipHash_Rounds(SIPHASH_CTX *, int); - -void -SipHash_Init(SIPHASH_CTX *ctx, const SIPHASH_KEY *key) -{ - uint64_t k0, k1; - - k0 = le64toh(key->k0); - k1 = le64toh(key->k1); - - ctx->v[0] = 0x736f6d6570736575ULL ^ k0; - ctx->v[1] = 0x646f72616e646f6dULL ^ k1; - ctx->v[2] = 0x6c7967656e657261ULL ^ k0; - ctx->v[3] = 0x7465646279746573ULL ^ k1; - - memset(ctx->buf, 0, sizeof(ctx->buf)); - ctx->bytes = 0; -} - -void -SipHash_Update(SIPHASH_CTX *ctx, int rc, int rf, const void *src, size_t len) -{ - const uint8_t *ptr = src; - size_t left, used; - - if (len == 0) - return; - - used = ctx->bytes % sizeof(ctx->buf); - ctx->bytes += len; - - if (used > 0) { - left = sizeof(ctx->buf) - used; - - if (len >= left) { - memcpy(&ctx->buf[used], ptr, left); - SipHash_CRounds(ctx, rc); - len -= left; - ptr += left; - } else { - memcpy(&ctx->buf[used], ptr, len); - return; - } - } - - while (len >= sizeof(ctx->buf)) { - memcpy(ctx->buf, ptr, sizeof(ctx->buf)); - SipHash_CRounds(ctx, rc); - len -= sizeof(ctx->buf); - ptr += sizeof(ctx->buf); - } - - if (len > 0) - memcpy(ctx->buf, ptr, len); -} - -void -SipHash_Final(void *dst, SIPHASH_CTX *ctx, int rc, int rf) -{ - uint64_t r; - - r = htole64(SipHash_End(ctx, rc, rf)); - memcpy(dst, &r, sizeof r); -} - -uint64_t -SipHash_End(SIPHASH_CTX *ctx, int rc, int rf) -{ - uint64_t r; - size_t left, used; - - used = ctx->bytes % sizeof(ctx->buf); - left = sizeof(ctx->buf) - used; - memset(&ctx->buf[used], 0, left - 1); - ctx->buf[7] = ctx->bytes; - - SipHash_CRounds(ctx, rc); - ctx->v[2] ^= 0xff; - SipHash_Rounds(ctx, rf); - - r = (ctx->v[0] ^ ctx->v[1]) ^ (ctx->v[2] ^ ctx->v[3]); - explicit_bzero(ctx, sizeof(*ctx)); - return (r); -} - -uint64_t -SipHash(const SIPHASH_KEY *key, int rc, int rf, const void *src, size_t len) -{ - SIPHASH_CTX ctx; - - SipHash_Init(&ctx, key); - SipHash_Update(&ctx, rc, rf, src, len); - return (SipHash_End(&ctx, rc, rf)); -} - -#define SIP_ROTL(x, b) ((x) << (b)) | ( (x) >> (64 - (b))) - -static void -SipHash_Rounds(SIPHASH_CTX *ctx, int rounds) -{ - while (rounds--) { - ctx->v[0] += ctx->v[1]; - ctx->v[2] += ctx->v[3]; - ctx->v[1] = SIP_ROTL(ctx->v[1], 13); - ctx->v[3] = SIP_ROTL(ctx->v[3], 16); - - ctx->v[1] ^= ctx->v[0]; - ctx->v[3] ^= ctx->v[2]; - ctx->v[0] = SIP_ROTL(ctx->v[0], 32); - - ctx->v[2] += ctx->v[1]; - ctx->v[0] += ctx->v[3]; - ctx->v[1] = SIP_ROTL(ctx->v[1], 17); - ctx->v[3] = SIP_ROTL(ctx->v[3], 21); - - ctx->v[1] ^= ctx->v[2]; - ctx->v[3] ^= ctx->v[0]; - ctx->v[2] = SIP_ROTL(ctx->v[2], 32); - } -} - -static void -SipHash_CRounds(SIPHASH_CTX *ctx, int rounds) -{ - uint64_t m = le64toh(*(uint64_t *)ctx->buf); - - ctx->v[3] ^= m; - SipHash_Rounds(ctx, rounds); - ctx->v[0] ^= m; -} diff --git a/devel/got/files/openbsd-compat/siphash.h b/devel/got/files/openbsd-compat/siphash.h deleted file mode 100644 index 471c965690c2..000000000000 --- a/devel/got/files/openbsd-compat/siphash.h +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * Copyright (c) 2013 Andre Oppermann - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $OpenBSD: siphash.h,v 1.4 2022/12/27 07:44:56 jmc Exp $ - */ - -/* - * SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) - * optimized for speed on short messages returning a 64bit hash/digest value. - * - * The number of rounds is defined during the initialization: - * SipHash24_Init() for the fast and reasonable strong version - * SipHash48_Init() for the strong version (half as fast) - * - * struct SIPHASH_CTX ctx; - * SipHash24_Init(&ctx); - * SipHash_SetKey(&ctx, "16bytes long key"); - * SipHash_Update(&ctx, pointer_to_string, length_of_string); - * SipHash_Final(output, &ctx); - */ - -#ifndef _SIPHASH_H_ -#define _SIPHASH_H_ - -#define SIPHASH_BLOCK_LENGTH 8 -#define SIPHASH_KEY_LENGTH 16 -#define SIPHASH_DIGEST_LENGTH 8 - -typedef struct _SIPHASH_CTX { - uint64_t v[4]; - uint8_t buf[SIPHASH_BLOCK_LENGTH]; - uint32_t bytes; -} SIPHASH_CTX; - -typedef struct { - uint64_t k0; - uint64_t k1; -} SIPHASH_KEY; - -void SipHash_Init(SIPHASH_CTX *, const SIPHASH_KEY *); -void SipHash_Update(SIPHASH_CTX *, int, int, const void *, size_t); -uint64_t SipHash_End(SIPHASH_CTX *, int, int); -void SipHash_Final(void *, SIPHASH_CTX *, int, int); -uint64_t SipHash(const SIPHASH_KEY *, int, int, const void *, size_t); - -#define SipHash24_Init(_c, _k) SipHash_Init((_c), (_k)) -#define SipHash24_Update(_c, _p, _l) SipHash_Update((_c), 2, 4, (_p), (_l)) -#define SipHash24_End(_d) SipHash_End((_d), 2, 4) -#define SipHash24_Final(_d, _c) SipHash_Final((_d), (_c), 2, 4) -#define SipHash24(_k, _p, _l) SipHash((_k), 2, 4, (_p), (_l)) - -#define SipHash48_Init(_c, _k) SipHash_Init((_c), (_k)) -#define SipHash48_Update(_c, _p, _l) SipHash_Update((_c), 4, 8, (_p), (_l)) -#define SipHash48_End(_d) SipHash_End((_d), 4, 8) -#define SipHash48_Final(_d, _c) SipHash_Final((_d), (_c), 4, 8) -#define SipHash48(_k, _p, _l) SipHash((_k), 4, 8, (_p), (_l)) - -#endif /* _SIPHASH_H_ */ diff --git a/devel/got/files/openbsd-compat/util.h b/devel/got/files/openbsd-compat/util.h deleted file mode 100644 index d985406bdee6..000000000000 --- a/devel/got/files/openbsd-compat/util.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _OPENBSD_COMPAT_UTIL_H_ -#define _OPENBSD_COMPAT_UTIL_H_ - -#include - -/* - * fmt_scaled(3) specific flags. - */ -#define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */ - -#define fmt_scaled(number, result) ({ \ - int64_t num = number; \ - int r = humanize_number(result, \ - FMT_SCALED_STRSIZE - (num < 0 ? 0 : 1), \ - num, "", HN_AUTOSCALE, HN_NOSPACE | HN_B); \ - r == -1 ? -1 : 0; \ -}) - -#endif diff --git a/devel/got/files/patch-Makefile b/devel/got/files/patch-Makefile deleted file mode 100644 index 3743115e5c72..000000000000 --- a/devel/got/files/patch-Makefile +++ /dev/null @@ -1,8 +0,0 @@ ---- Makefile.orig 2021-04-10 22:50:22 UTC -+++ Makefile -@@ -1,4 +1,4 @@ --SUBDIR = libexec got tog gotadmin -+SUBDIR = openbsd-compat libexec got tog gotadmin - - .PHONY: release dist - diff --git a/devel/got/files/patch-Makefile.in b/devel/got/files/patch-Makefile.in new file mode 100644 index 000000000000..36ea62f88fb6 --- /dev/null +++ b/devel/got/files/patch-Makefile.in @@ -0,0 +1,11 @@ +--- Makefile.in.orig 2024-04-25 19:30:16 UTC ++++ Makefile.in +@@ -370,7 +370,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = \ + --enable-cvg \ + --enable-gotd + +-SUBDIRS = compat libexec got tog gotadmin template gotwebd \ ++SUBDIRS = compat libexec got tog gotadmin template \ + $(am__append_1) $(am__append_2) + EXTRA_DIST = CHANGES CHANGELOG LICENCE README.portable util/got-portable-ver.sh + LDADD = $(LIBOBJS) $(am__append_3) diff --git a/devel/got/files/patch-Makefile.inc b/devel/got/files/patch-Makefile.inc deleted file mode 100644 index 0e34a26d1973..000000000000 --- a/devel/got/files/patch-Makefile.inc +++ /dev/null @@ -1,28 +0,0 @@ ---- Makefile.inc.orig 2023-09-03 23:15:32 UTC -+++ Makefile.inc -@@ -6,11 +6,24 @@ CPPFLAGS += -DGOT_LIBEXECDIR=${LIBEXECDIR} -DGOT_VERSI - #CFLAGS += -DGOT_DELTA_CACHE_DEBUG - #CFLAGS += -DGOT_DIFF_NO_MMAP - -+# work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63567 -+.include -+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} < 50000 -+CSTD = gnu89 -+.endif -+ -+OPENBSD_COMPAT := ${.PARSEDIR}/openbsd-compat -+CFLAGS += ${CPPFLAGS} -I${OPENBSD_COMPAT} -+CFLAGS += -Wno-pointer-sign -+ -+LDFLAGS += -L${OPENBSD_COMPAT} -+LDADD += -lopenbsd-compat -lmd -+ - .if "${GOT_RELEASE}" == "Yes" - PREFIX ?= /usr/local - BINDIR ?= ${PREFIX}/bin - LIBEXECDIR ?= ${PREFIX}/libexec --MANDIR ?= ${PREFIX}/man/man -+MANDIR ?= ${PREFIX}/share/man/man - .else - CFLAGS += -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes - CFLAGS += -Wwrite-strings -Wunused-variable diff --git a/devel/got/files/patch-configure b/devel/got/files/patch-configure new file mode 100644 index 000000000000..16454c6bb8e5 --- /dev/null +++ b/devel/got/files/patch-configure @@ -0,0 +1,15 @@ +--- configure.orig 2024-04-25 19:31:02 UTC ++++ configure +@@ -10046,9 +10046,9 @@ fi + + fi + +-if test "x$found_libevent" = xno; then +- as_fn_error $? "\"libevent not found\"" "$LINENO" 5 +-fi ++#if test "x$found_libevent" = xno; then ++# as_fn_error $? "\"libevent not found\"" "$LINENO" 5 ++#fi + + ac_fn_c_check_func "$LINENO" "uuid_create" "ac_cv_func_uuid_create" + if test "x$ac_cv_func_uuid_create" = xyes diff --git a/devel/got/files/patch-got_Makefile b/devel/got/files/patch-got_Makefile deleted file mode 100644 index fe501a4835a5..000000000000 --- a/devel/got/files/patch-got_Makefile +++ /dev/null @@ -1,11 +0,0 @@ ---- got/Makefile.orig 2022-01-19 10:29:31 UTC -+++ got/Makefile -@@ -30,8 +30,4 @@ DPADD = ${LIBZ} ${LIBUTIL} - NOMAN = Yes - .endif - --realinstall: -- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ -- -m ${BINMODE} ${PROG} ${BINDIR}/${PROG} -- - .include diff --git a/devel/got/files/patch-gotadmin_Makefile b/devel/got/files/patch-gotadmin_Makefile deleted file mode 100644 index ad34cefb8344..000000000000 --- a/devel/got/files/patch-gotadmin_Makefile +++ /dev/null @@ -1,11 +0,0 @@ ---- gotadmin/Makefile.orig 2022-07-03 11:08:45 UTC -+++ gotadmin/Makefile -@@ -25,8 +25,4 @@ DPADD = ${LIBZ} ${LIBUTIL} - NOMAN = Yes - .endif - --realinstall: -- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ -- -m ${BINMODE} ${PROG} ${BINDIR}/${PROG} -- - .include diff --git a/devel/got/files/patch-libexec_Makefile.inc b/devel/got/files/patch-libexec_Makefile.inc deleted file mode 100644 index 60e91e9a9924..000000000000 --- a/devel/got/files/patch-libexec_Makefile.inc +++ /dev/null @@ -1,12 +0,0 @@ ---- libexec/Makefile.inc.orig 2020-09-10 19:02:02 UTC -+++ libexec/Makefile.inc -@@ -1,7 +1,5 @@ - .include "../Makefile.inc" - --realinstall: -- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ -- -m ${BINMODE} ${PROG} ${LIBEXECDIR}/${PROG} -+BINDIR = ${PREFIX}/libexec - --NOMAN = Yes -+MAN = diff --git a/devel/got/files/patch-libexec_got-fetch-pack_got-fetch-pack.c b/devel/got/files/patch-libexec_got-fetch-pack_got-fetch-pack.c deleted file mode 100644 index 73748c625db3..000000000000 --- a/devel/got/files/patch-libexec_got-fetch-pack_got-fetch-pack.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-fetch-pack/got-fetch-pack.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-fetch-pack/got-fetch-pack.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -799,6 +800,11 @@ main(int argc, char **argv) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-index-pack_got-index-pack.c b/devel/got/files/patch-libexec_got-index-pack_got-index-pack.c deleted file mode 100644 index bc07b3bdb9bc..000000000000 --- a/devel/got/files/patch-libexec_got-index-pack_got-index-pack.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-index-pack/got-index-pack.c.orig 2022-10-20 14:40:52 UTC -+++ libexec/got-index-pack/got-index-pack.c -@@ -15,6 +15,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -110,6 +111,11 @@ main(int argc, char **argv) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-blob_got-read-blob.c b/devel/got/files/patch-libexec_got-read-blob_got-read-blob.c deleted file mode 100644 index 4b228ab2e94f..000000000000 --- a/devel/got/files/patch-libexec_got-read-blob_got-read-blob.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-blob/got-read-blob.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-blob/got-read-blob.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -65,6 +66,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-commit_got-read-commit.c b/devel/got/files/patch-libexec_got-read-commit_got-read-commit.c deleted file mode 100644 index df51f2405e76..000000000000 --- a/devel/got/files/patch-libexec_got-read-commit_got-read-commit.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-commit/got-read-commit.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-commit/got-read-commit.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -119,6 +120,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-gitconfig_got-read-gitconfig.c b/devel/got/files/patch-libexec_got-read-gitconfig_got-read-gitconfig.c deleted file mode 100644 index 928cbcdc5e37..000000000000 --- a/devel/got/files/patch-libexec_got-read-gitconfig_got-read-gitconfig.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-gitconfig/got-read-gitconfig.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-gitconfig/got-read-gitconfig.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -329,6 +330,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-gotconfig_got-read-gotconfig.c b/devel/got/files/patch-libexec_got-read-gotconfig_got-read-gotconfig.c deleted file mode 100644 index 2c783637b615..000000000000 --- a/devel/got/files/patch-libexec_got-read-gotconfig_got-read-gotconfig.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-gotconfig/got-read-gotconfig.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-gotconfig/got-read-gotconfig.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -494,6 +495,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-object_got-read-object.c b/devel/got/files/patch-libexec_got-read-object_got-read-object.c deleted file mode 100644 index 718e58514479..000000000000 --- a/devel/got/files/patch-libexec_got-read-object_got-read-object.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-object/got-read-object.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-object/got-read-object.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -140,6 +141,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-pack_got-read-pack.c b/devel/got/files/patch-libexec_got-read-pack_got-read-pack.c deleted file mode 100644 index 926785d07069..000000000000 --- a/devel/got/files/patch-libexec_got-read-pack_got-read-pack.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-pack/got-read-pack.c.orig 2022-07-04 14:48:30 UTC -+++ libexec/got-read-pack/got-read-pack.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -1917,6 +1918,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-patch_got-read-patch.c b/devel/got/files/patch-libexec_got-read-patch_got-read-patch.c deleted file mode 100644 index 6bdec6c59be9..000000000000 --- a/devel/got/files/patch-libexec_got-read-patch_got-read-patch.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-patch/got-read-patch.c.orig 2022-07-04 14:48:30 UTC -+++ libexec/got-read-patch/got-read-patch.c -@@ -35,6 +35,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -578,6 +579,11 @@ main(int argc, char **argv) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-tag_got-read-tag.c b/devel/got/files/patch-libexec_got-read-tag_got-read-tag.c deleted file mode 100644 index 1c34d63847f5..000000000000 --- a/devel/got/files/patch-libexec_got-read-tag_got-read-tag.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-tag/got-read-tag.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-tag/got-read-tag.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -114,6 +115,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-read-tree_got-read-tree.c b/devel/got/files/patch-libexec_got-read-tree_got-read-tree.c deleted file mode 100644 index 13a2bf0d34e5..000000000000 --- a/devel/got/files/patch-libexec_got-read-tree_got-read-tree.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-read-tree/got-read-tree.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-read-tree/got-read-tree.c -@@ -14,6 +14,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -113,6 +114,11 @@ main(int argc, char *argv[]) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-libexec_got-send-pack_got-send-pack.c b/devel/got/files/patch-libexec_got-send-pack_got-send-pack.c deleted file mode 100644 index 9c7707566103..000000000000 --- a/devel/got/files/patch-libexec_got-send-pack_got-send-pack.c +++ /dev/null @@ -1,22 +0,0 @@ ---- libexec/got-send-pack/got-send-pack.c.orig 2022-06-19 18:47:42 UTC -+++ libexec/got-send-pack/got-send-pack.c -@@ -15,6 +15,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include -@@ -595,6 +596,11 @@ main(int argc, char **argv) - /* revoke access to most system calls */ - if (pledge("stdio recvfd", NULL) == -1) { - err = got_error_from_errno("pledge"); -+ got_privsep_send_error(&ibuf, err); -+ return 1; -+ } -+ if (cap_enter() == -1) { -+ err = got_error_from_errno("cap_enter"); - got_privsep_send_error(&ibuf, err); - return 1; - } diff --git a/devel/got/files/patch-regress_Makefile b/devel/got/files/patch-regress_Makefile deleted file mode 100644 index fa952d787b2e..000000000000 --- a/devel/got/files/patch-regress_Makefile +++ /dev/null @@ -1,9 +0,0 @@ ---- regress/Makefile.orig 2023-04-20 20:02:28 UTC -+++ regress/Makefile -@@ -4,4 +4,6 @@ SUBDIR = cmdline delta deltify idset path fetch tog - SUBDIR += gotd - .endif - -+SUBDIR_TARGETS+= regress -+ - .include diff --git a/devel/got/files/patch-regress_cmdline_Makefile b/devel/got/files/patch-regress_cmdline_Makefile deleted file mode 100644 index 2f2640e43ccf..000000000000 --- a/devel/got/files/patch-regress_cmdline_Makefile +++ /dev/null @@ -1,10 +0,0 @@ ---- regress/cmdline/Makefile.orig 2023-07-10 07:49:48 UTC -+++ regress/cmdline/Makefile -@@ -105,4 +105,6 @@ dump: - load: - ./load.sh -q -r "$(GOT_TEST_ROOT)" - --.include -+regress: ${REGRESS_TARGETS} .PHONY .SILENT -+ -+.include diff --git a/devel/got/files/patch-regress_delta_Makefile b/devel/got/files/patch-regress_delta_Makefile deleted file mode 100644 index 396bea89d157..000000000000 --- a/devel/got/files/patch-regress_delta_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- regress/delta/Makefile.orig 2020-08-09 09:17:05 UTC -+++ regress/delta/Makefile -@@ -8,7 +8,7 @@ LDADD = -lz - - NOMAN = yes - --run-regress-delta_test: -+regress: ${PROG} .PHONY - ${.OBJDIR}/delta_test -q - --.include -+.include diff --git a/devel/got/files/patch-regress_deltify_Makefile b/devel/got/files/patch-regress_deltify_Makefile deleted file mode 100644 index 28238d5bb22e..000000000000 --- a/devel/got/files/patch-regress_deltify_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- regress/deltify/Makefile.orig 2021-03-22 15:38:56 UTC -+++ regress/deltify/Makefile -@@ -8,7 +8,7 @@ LDADD = -lz - - NOMAN = yes - --run-regress-deltify_test: -+regress: ${PROG} .PHONY - ${.OBJDIR}/deltify_test -q - --.include -+.include diff --git a/devel/got/files/patch-regress_fetch_Makefile b/devel/got/files/patch-regress_fetch_Makefile deleted file mode 100644 index 3cf02b0e7d58..000000000000 --- a/devel/got/files/patch-regress_fetch_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- regress/fetch/Makefile.orig 2022-07-03 11:08:45 UTC -+++ regress/fetch/Makefile -@@ -12,7 +12,7 @@ LDADD = -lutil -lz -lm - - NOMAN = yes - --run-regress-fetch_test: -+regress: ${PROG} .PHONY - ${.OBJDIR}/fetch_test -q - --.include -+.include diff --git a/devel/got/files/patch-regress_idset_Makefile b/devel/got/files/patch-regress_idset_Makefile deleted file mode 100644 index d3da8c50877d..000000000000 --- a/devel/got/files/patch-regress_idset_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- regress/idset/Makefile.orig 2020-08-09 09:17:05 UTC -+++ regress/idset/Makefile -@@ -9,7 +9,7 @@ LDADD = -lutil -lz - - NOMAN = yes - --run-regress-idset_test: -+regress: ${PROG} .PHONY - ${.OBJDIR}/idset_test -q - --.include -+.include diff --git a/devel/got/files/patch-regress_path_Makefile b/devel/got/files/patch-regress_path_Makefile deleted file mode 100644 index f3240e0f74d5..000000000000 --- a/devel/got/files/patch-regress_path_Makefile +++ /dev/null @@ -1,12 +0,0 @@ ---- regress/path/Makefile.orig 2020-08-09 09:17:05 UTC -+++ regress/path/Makefile -@@ -8,7 +8,7 @@ LDADD = -lutil -lz - - NOMAN = yes - --run-regress-path_test: -+regress: ${PROG} .PHONY - ${.OBJDIR}/path_test -q - --.include -+.include diff --git a/devel/got/files/patch-regress_tog_Makefile b/devel/got/files/patch-regress_tog_Makefile deleted file mode 100644 index 9239ad235368..000000000000 --- a/devel/got/files/patch-regress_tog_Makefile +++ /dev/null @@ -1,10 +0,0 @@ ---- regress/tog/Makefile.orig 2023-04-20 13:59:00 UTC -+++ regress/tog/Makefile -@@ -15,4 +15,6 @@ blame: - tree: - ./tree.sh -q -r "$(GOT_TEST_ROOT)" - --.include -+regress: ${REGRESS_TARGETS} .PHONY .SILENT -+ -+.include diff --git a/devel/got/files/patch-tog_Makefile b/devel/got/files/patch-tog_Makefile deleted file mode 100644 index d95ee00e9d7a..000000000000 --- a/devel/got/files/patch-tog_Makefile +++ /dev/null @@ -1,11 +0,0 @@ ---- tog/Makefile.orig 2020-11-10 22:54:37 UTC -+++ tog/Makefile -@@ -28,8 +28,4 @@ DPADD = ${LIBZ} ${LIBUTIL} - NOMAN = Yes - .endif - --realinstall: -- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ -- -m ${BINMODE} ${PROG} ${BINDIR}/${PROG} -- - .include -- cgit v1.2.3