opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: 8bbdc8d2bf2d72862bfc2012931c3bf4cf8bf817
Parent: e6b565c0d8ee6a2b47077340b1714c99f7472d95
Author: Michael Forney
Date:   Thu,  2 Apr 2026 17:19:10 -0700

openbsd: Various portability fixes

Diffstat:
Mpkg/sys/openbsd/patch/0024-rsync-Avoid-pointer-arithmetic-on-void.patch | 26++++++++++++++++++++++----
Apkg/sys/openbsd/patch/0041-Explicitly-cast-arguments-to-functions-expecting-cha.patch | 148+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/sys/openbsd/patch/0042-fts-Use-prototype-in-declaration-of-fts_compar.patch | 26++++++++++++++++++++++++++
Mpkg/sys/openbsd/ver | 2+-
4 files changed, 197 insertions(+), 5 deletions(-)

diff --git a/pkg/sys/openbsd/patch/0024-rsync-Avoid-pointer-arithmetic-on-void.patch b/pkg/sys/openbsd/patch/0024-rsync-Avoid-pointer-arithmetic-on-void.patch @@ -1,17 +1,17 @@ -From 3823d88a12d7c95de2d4b68796b5faa7f550caed Mon Sep 17 00:00:00 2001 +From 2dc242877741913abaf8685c616406812d507e17 Mon Sep 17 00:00:00 2001 From: Michael Forney <mforney@mforney.org> Date: Sat, 15 Jun 2019 20:06:13 -0700 Subject: [PATCH] rsync: Avoid pointer arithmetic on `void *` --- - usr.bin/rsync/blocks.c | 8 ++++---- + usr.bin/rsync/blocks.c | 12 ++++++------ usr.bin/rsync/downloader.c | 2 +- usr.bin/rsync/io.c | 12 ++++++------ usr.bin/rsync/sender.c | 5 +++-- - 4 files changed, 14 insertions(+), 13 deletions(-) + 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/usr.bin/rsync/blocks.c b/usr.bin/rsync/blocks.c -index d1d9b19c31e..8f4bcb532e1 100644 +index d1d9b19c31e..9aca8c217a6 100644 --- a/usr.bin/rsync/blocks.c +++ b/usr.bin/rsync/blocks.c @@ -163,7 +163,7 @@ blk_find(struct sess *sess, struct blkstat *st, @@ -50,6 +50,24 @@ index d1d9b19c31e..8f4bcb532e1 100644 st->s1 -= map[0]; st->s2 -= osz * map[0]; +@@ -287,7 +287,7 @@ blk_match(struct sess *sess, const struct blkset *blks, + blk->len, blk->idx); + tok = -(blk->idx + 1); + +- hash_file_buf(&st->ctx, st->map + last, sz + blk->len); ++ hash_file_buf(&st->ctx, (char *)st->map + last, sz + blk->len); + + /* + * Write the data we have, then follow it with +@@ -312,7 +312,7 @@ blk_match(struct sess *sess, const struct blkset *blks, + LOG4("%s: flushing %s %jd B", path, + last == 0 ? "whole" : "remaining", (intmax_t)sz); + +- hash_file_buf(&st->ctx, st->map + last, sz); ++ hash_file_buf(&st->ctx, (char *)st->map + last, sz); + + st->total += sz; + st->dirty += sz; diff --git a/usr.bin/rsync/downloader.c b/usr.bin/rsync/downloader.c index cab6eb23f9f..07ec334f6b4 100644 --- a/usr.bin/rsync/downloader.c diff --git a/pkg/sys/openbsd/patch/0041-Explicitly-cast-arguments-to-functions-expecting-cha.patch b/pkg/sys/openbsd/patch/0041-Explicitly-cast-arguments-to-functions-expecting-cha.patch @@ -0,0 +1,148 @@ +From d74af6c05b11f5d000f0a4aae3c287b6d4e2829f Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 2 Apr 2026 17:02:47 -0700 +Subject: [PATCH] Explicitly cast arguments to functions expecting char pointer + with other sign + +--- + usr.bin/diff/diffreg.c | 10 +++++----- + usr.bin/nc/socks.c | 30 +++++++++++++++--------------- + usr.sbin/acme-client/acctproc.c | 3 ++- + 3 files changed, 22 insertions(+), 21 deletions(-) + +diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c +index 3470f54c337..c36765a44c8 100644 +--- a/usr.bin/diff/diffreg.c ++++ b/usr.bin/diff/diffreg.c +@@ -1269,19 +1269,19 @@ match_function(const long *f, int pos, FILE *fp) + nc = fread(buf, 1, nc, fp); + if (nc > 0) { + buf[nc] = '\0'; +- buf[strcspn(buf, "\n")] = '\0'; ++ buf[strcspn((char *)buf, "\n")] = '\0'; + if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { +- if (begins_with(buf, "private:")) { ++ if (begins_with((char *)buf, "private:")) { + if (!state) + state = " (private)"; +- } else if (begins_with(buf, "protected:")) { ++ } else if (begins_with((char *)buf, "protected:")) { + if (!state) + state = " (protected)"; +- } else if (begins_with(buf, "public:")) { ++ } else if (begins_with((char *)buf, "public:")) { + if (!state) + state = " (public)"; + } else { +- strlcpy(lastbuf, buf, sizeof lastbuf); ++ strlcpy(lastbuf, (char *)buf, sizeof lastbuf); + if (state) + strlcat(lastbuf, state, + sizeof lastbuf); +diff --git a/usr.bin/nc/socks.c b/usr.bin/nc/socks.c +index 1f1fb96e2af..37a18f191f2 100644 +--- a/usr.bin/nc/socks.c ++++ b/usr.bin/nc/socks.c +@@ -88,7 +88,7 @@ decode_addrport(const char *h, const char *p, struct sockaddr *addr, + } + + static int +-proxy_read_line(int fd, char *buf, size_t bufsz) ++proxy_read_line(int fd, unsigned char *buf, size_t bufsz) + { + size_t off; + +@@ -315,7 +315,7 @@ socks_connect(const char *host, const char *port, + wlen = 9; + if (socksv == 44) { + /* SOCKS4A has nul-terminated hostname after user */ +- if (strlcpy(buf + 9, host, ++ if (strlcpy((char *)buf + 9, host, + sizeof(buf) - 9) >= sizeof(buf) - 9) + errx(1, "hostname too big"); + wlen = 9 + strlen(host) + 1; +@@ -340,17 +340,17 @@ socks_connect(const char *host, const char *port, + + /* Try to be sane about numeric IPv6 addresses */ + if (strchr(host, ':') != NULL) { +- r = snprintf(buf, sizeof(buf), ++ r = snprintf((char *)buf, sizeof(buf), + "CONNECT [%s]:%d HTTP/1.0\r\n", + host, ntohs(serverport)); + } else { +- r = snprintf(buf, sizeof(buf), ++ r = snprintf((char *)buf, sizeof(buf), + "CONNECT %s:%d HTTP/1.0\r\n", + host, ntohs(serverport)); + } + if (r < 0 || (size_t)r >= sizeof(buf)) + errx(1, "hostname too long"); +- r = strlen(buf); ++ r = strlen((char *)buf); + + cnt = atomicio(vwrite, proxyfd, buf, r); + if (cnt != r) +@@ -362,18 +362,18 @@ socks_connect(const char *host, const char *port, + + getproxypass(proxyuser, proxyhost, + proxypass, sizeof proxypass); +- r = snprintf(buf, sizeof(buf), "%s:%s", ++ r = snprintf((char *)buf, sizeof(buf), "%s:%s", + proxyuser, proxypass); + explicit_bzero(proxypass, sizeof proxypass); + if (r == -1 || (size_t)r >= sizeof(buf) || +- b64_ntop(buf, strlen(buf), resp, ++ b64_ntop(buf, strlen((char *)buf), resp, + sizeof(resp)) == -1) + errx(1, "Proxy username/password too long"); +- r = snprintf(buf, sizeof(buf), "Proxy-Authorization: " +- "Basic %s\r\n", resp); ++ r = snprintf((char *)buf, sizeof(buf), ++ "Proxy-Authorization: Basic %s\r\n", resp); + if (r < 0 || (size_t)r >= sizeof(buf)) + errx(1, "Proxy auth response too long"); +- r = strlen(buf); ++ r = strlen((char *)buf); + if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r) + err(1, "write failed (%zu/%d)", cnt, r); + explicit_bzero(proxypass, sizeof proxypass); +@@ -387,17 +387,17 @@ socks_connect(const char *host, const char *port, + /* Read status reply */ + proxy_read_line(proxyfd, buf, sizeof(buf)); + if (proxyuser != NULL && +- (strncmp(buf, "HTTP/1.0 407 ", 13) == 0 || +- strncmp(buf, "HTTP/1.1 407 ", 13) == 0)) { ++ (strncmp((char *)buf, "HTTP/1.0 407 ", 13) == 0 || ++ strncmp((char *)buf, "HTTP/1.1 407 ", 13) == 0)) { + if (authretry > 1) { + fprintf(stderr, "Proxy authentication " + "failed\n"); + } + close(proxyfd); + goto again; +- } else if (strncmp(buf, "HTTP/1.0 200 ", 13) != 0 && +- strncmp(buf, "HTTP/1.1 200 ", 13) != 0) +- errx(1, "Proxy error: \"%s\"", buf); ++ } else if (strncmp((char *)buf, "HTTP/1.0 200 ", 13) != 0 && ++ strncmp((char *)buf, "HTTP/1.1 200 ", 13) != 0) ++ errx(1, "Proxy error: \"%s\"", (char *)buf); + + /* Headers continue until we hit an empty line */ + for (r = 0; r < HTTP_MAXHDRS; r++) { +diff --git a/usr.sbin/acme-client/acctproc.c b/usr.sbin/acme-client/acctproc.c +index 8d66dac49d9..6bc647c6009 100644 +--- a/usr.sbin/acme-client/acctproc.c ++++ b/usr.sbin/acme-client/acctproc.c +@@ -215,7 +215,8 @@ op_sign(int fd, struct key *key, enum acctop op) + + /* Base64-encode the payload. */ + +- if ((pay64 = base64buf_url(pay, strlen(pay))) == NULL) { ++ if ((pay64 = base64buf_url((unsigned char *)pay, ++ strlen(pay))) == NULL) { + warnx("base64buf_url"); + goto out; + } +-- +2.49.0 + diff --git a/pkg/sys/openbsd/patch/0042-fts-Use-prototype-in-declaration-of-fts_compar.patch b/pkg/sys/openbsd/patch/0042-fts-Use-prototype-in-declaration-of-fts_compar.patch @@ -0,0 +1,26 @@ +From 5b997ce94b67bfd5c3f1a34c33fb14b11a8b5c81 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 2 Apr 2026 17:17:27 -0700 +Subject: [PATCH] fts: Use prototype in declaration of fts_compar + +In C23, empty parenthesis indications a function taking no arguments. +--- + include/fts.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/fts.h b/include/fts.h +index a5b3aff91e7..ef25e88d298 100644 +--- a/include/fts.h ++++ b/include/fts.h +@@ -46,7 +46,7 @@ typedef struct { + int fts_rfd; /* fd for root */ + size_t fts_pathlen; /* sizeof(path) */ + int fts_nitems; /* elements in the sort array */ +- int (*fts_compar)(); /* compare function */ ++ int (*fts_compar)(const void *, const void *); /* compare function */ + + #define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */ + #define FTS_LOGICAL 0x0002 /* logical walk */ +-- +2.49.0 + diff --git a/pkg/sys/openbsd/ver b/pkg/sys/openbsd/ver @@ -1 +1 @@ -7.8 r0 +7.8 r1