Refresh upstream recipe compatibility

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-15 12:57:45 +01:00
parent 043c7ba0d7
commit 2a050b7c43
6 changed files with 109 additions and 148 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
#TODO lack of resolv.h, expect dns not working
#TODO resolver runtime on Redox still needs stronger validation; relibc now exports resolv.h/nameser surfaces
#TODO lack of utmpx.h, expect no way to track login in sshd
[source]
tar = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz"
@@ -14,6 +14,15 @@ dependencies = [
]
script = """
DYNAMIC_INIT
RELIBC_STAGE_INCLUDE="${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage/usr/include"
RELIBC_STAGE_LIB="${COOKBOOK_ROOT}/recipes/core/relibc/target/${TARGET}/stage/usr/lib"
if [ -d "${RELIBC_STAGE_INCLUDE}" ]; then
export CPPFLAGS="${CPPFLAGS} -I${RELIBC_STAGE_INCLUDE}"
export CFLAGS="${CFLAGS} -I${RELIBC_STAGE_INCLUDE}"
fi
if [ -d "${RELIBC_STAGE_LIB}" ]; then
export LDFLAGS="-L${RELIBC_STAGE_LIB} -Wl,-rpath-link,${RELIBC_STAGE_LIB} ${LDFLAGS}"
fi
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-strip
--sysconfdir=/etc/ssh
+27 -105
View File
@@ -70,9 +70,9 @@ diff -ruwN source/hostfile.c source-new/hostfile.c
#include <netinet/in.h>
#include <errno.h>
+#ifndef __redox__
+/* Redox now has relibc resolv.h support. */
+/* Keep this hunk explicit for downstream patch clarity. */
#include <resolv.h>
+#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -165,128 +165,50 @@ diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-sta
diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getrrsetbyname.c
--- source/openbsd-compat/getrrsetbyname.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/getrrsetbyname.c 2025-09-06 21:09:36.556438304 +0700
@@ -67,6 +67,52 @@
#endif
#define _THREAD_PRIVATE(a,b,c) (c)
+#ifdef __redox__
+
+#include <sys/types.h>
+#include <stdint.h>
+
+/*
+ * Minimalist replacement for <resolv.h> for systems that lack it,
+ * such as Redox OS. This provides the basic structures needed by
+ * the OpenSSH compatibility layer.
+ */
+
+// Define necessary constants
+#define MAXNS 3 /* max # name servers we'll track */
+#define MAXDNSRCH 6 /* max # domains in search path */
+#define MAXRESOLVSORT 10 /* number of nets to sort on */
+#define MAXDNAME 256 /* max length of a domain name */
+
+/*
+ * A simplified, portable version of the resolver state structure.
+ * Glibc-specific fields, hooks, and complex unions have been removed.
+ */
+struct __res_state {
+ int retrans; /* retransmission time interval */
+ int retry; /* number of times to retransmit */
+ unsigned long options; /* option flags */
+ int nscount; /* number of name servers */
+ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name servers */
+ unsigned short id; /* current message id */
+ char *dnsrch[MAXDNSRCH + 1]; /* components of domain to search */
+ char defdname[MAXDNAME]; /* default domain name */
+
+ struct {
+ struct in_addr addr;
+ uint32_t mask;
+ } sort_list[MAXRESOLVSORT];
+
+ int res_h_errno; /* last error code for this context */
+
+ // Simplified bitfields, removing glibc internals
+ unsigned ndots : 4; /* threshold for initial abs. query */
+ unsigned nsort : 4; /* number of elements in sort_list[] */
+};
+
+typedef struct __res_state *res_state;
+#endif /* __redox */
+
#ifndef HAVE__RES_EXTERN
struct __res_state _res;
#endif
@@ -167,6 +213,24 @@
struct dns_rr *next;
};
+#ifdef __redox__
+typedef struct {
+ uint16_t id;
+ uint8_t rd : 1;
+ uint8_t tc : 1;
+ uint8_t aa : 1;
+ uint8_t opcode : 4;
+ uint8_t qr : 1;
+ uint8_t rcode : 4;
+ uint8_t z : 3;
+ uint8_t ra : 1;
+ uint16_t qdcount;
+ uint16_t ancount;
+ uint16_t nscount;
+ uint16_t arcount;
+} HEADER;
+#endif
+
struct dns_response {
HEADER header;
struct dns_query *query;
@@ -221,10 +285,10 @@
@@ -221,10 +221,10 @@
}
/* initialize resolver */
- if ((_resp->options & RES_INIT) == 0 && res_init() == -1) {
+ // if (res_init() == -1) {
+ if ((_resp->options & RES_INIT) == 0 && res_init() == -1) {
result = ERRSET_FAIL;
goto fail;
- }
+ // }
+ }
#ifdef DEBUG
_resp->options |= RES_DEBUG;
@@ -482,12 +546,12 @@
@@ -482,12 +482,12 @@
prev->next = curr;
/* name */
- length = dn_expand(answer, answer + size, *cp, name,
- sizeof(name));
- if (length < 0) {
+ // length = dn_expand(answer, answer + size, *cp, name,
+ // sizeof(name));
+ // if (length < 0) {
+ length = dn_expand(answer, answer + size, *cp, name,
+ sizeof(name));
+ if (length < 0) {
free_dns_query(head);
return (NULL);
- }
+ // }
+ }
curr->name = strdup(name);
if (curr->name == NULL) {
free_dns_query(head);
@@ -542,12 +606,12 @@
@@ -542,12 +542,12 @@
prev->next = curr;
/* name */
- length = dn_expand(answer, answer + size, *cp, name,
- sizeof(name));
- if (length < 0) {
+ // length = dn_expand(answer, answer + size, *cp, name,
+ // sizeof(name));
+ // if (length < 0) {
+ length = dn_expand(answer, answer + size, *cp, name,
+ sizeof(name));
+ if (length < 0) {
free_dns_rr(head);
return (NULL);
- }
+ // }
+ }
curr->name = strdup(name);
if (curr->name == NULL) {
free_dns_rr(head);
@@ -297,13 +219,13 @@ diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getr
#include <sys/types.h>
#include <netinet/in.h>
+#ifndef __redox__
+/* Redox now has relibc arpa/nameser.h support. */
+/* Keep this include active instead of patch-local fallbacks. */
#include <arpa/nameser.h>
+#endif
#include <netdb.h>
+#ifndef __redox__
+/* Redox now has relibc resolv.h support. */
+/* Keep this include active instead of patch-local fallbacks. */
#include <resolv.h>
+#endif
#ifndef HFIXEDSZ
#define HFIXEDSZ 12
@@ -314,9 +236,9 @@ diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#ifndef __redox__
+/* Redox now has relibc arpa/nameser.h support. */
+/* Keep this include active. */
#include <arpa/nameser.h>
+#endif
#include <string.h>
#include <errno.h>
#include <stdio.h>
@@ -453,9 +375,9 @@ diff -ruwN source/regress/netcat.c source-new/regress/netcat.c
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifndef __redox__
+/* Redox now has relibc resolv.h support. */
+/* Keep this include active. */
#include <resolv.h>
+#endif
#define SOCKS_PORT "1080"
#define HTTP_PROXY_PORT "3128"
@@ -498,9 +420,9 @@ diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c
#include <stdio.h>
#include <limits.h>
#include <string.h>
+#ifndef __redox__
+/* Redox now has relibc resolv.h support. */
+/* Keep this include active. */
#include <resolv.h>
+#endif
#include <ctype.h>
#include <unistd.h>
@@ -614,9 +536,9 @@ diff -ruwN source/sshkey.c source-new/sshkey.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef __redox__
+/* Redox now has relibc resolv.h support. */
+/* Keep this include active. */
#include <resolv.h>
+#endif
#include <time.h>
#ifdef HAVE_UTIL_H
#include <util.h>
+8
View File
@@ -28,3 +28,11 @@ cookbook_configure
ln -s "bash" "${COOKBOOK_STAGE}/usr/bin/sh"
cp -r "${COOKBOOK_RECIPE}/etc" "${COOKBOOK_STAGE}/etc"
"""
[package]
name = "bash"
[package.files]
"/usr/bin/bash" = "bash"
"/usr/bin/sh" = "sh"
"/usr/bin/bashbug" = "bashbug"
+30
View File
@@ -2,6 +2,34 @@
Experimental ports not yet ready for production. Wayland, KDE, GNOME, and driver WIP.
## OWNERSHIP RULE FOR UPSTREAM WIP
In Red Bear OS, an upstream recipe or subsystem being marked **WIP** changes how we treat it.
### What WIP means for Red Bear
If an upstream recipe, package group, or subsystem is still WIP:
1. Red Bear treats that area as a **local project** rather than a first-class upstream dependency
2. we may study, import, and refresh from the upstream WIP recipe
3. but the version we fix, validate, and ship should live in the Red Bear overlay (`local/recipes/`,
`local/patches/`, `local/docs/`), not in trust of the upstream WIP tree alone
### What happens when upstream promotes it
If upstream later removes the WIP status and the recipe becomes a first-class supported Redox
package, Red Bear should reevaluate immediately:
- prefer the upstream recipe where it now solves the same problem adequately
- reduce or remove the local Red Bear copy/patches if they are no longer needed
- keep only the Red Bear-specific integration delta that upstream still does not solve
### Practical implication
`recipes/wip/` is therefore not “safe upstream ownership” for Red Bear shipping decisions. For this
project, upstream WIP is a **source of inputs and ideas**, but stable Red Bear delivery should come
from the local overlay until upstream promotes that work.
## STRUCTURE
```
@@ -66,3 +94,5 @@ recipes/wip/
- BLAKE3 hashes optional for WIP
- Test with `make r.<package>` before adding to config
- When ready: move from `wip/` to appropriate category, add BLAKE3 hash
- If Red Bear depends on a WIP subsystem long-term, prefer moving the maintained shipping version
under `local/recipes/` and documenting the delta in `local/docs/`
+10 -1
View File
@@ -2,5 +2,14 @@
# lacking build instructions
[source]
tar = "https://download.kde.org/stable/frameworks/5.112/breeze-icons-5.112.0.tar.xz"
[build]
template = "cmake"
template = "custom"
dependencies = [
"kf6-extra-cmake-modules",
]
script = """
DYNAMIC_INIT
COOKBOOK_CMAKE_FLAGS+=("-DKF_IGNORE_PLATFORM_CHECK=ON")
cookbook_cmake
"""
@@ -11,20 +11,3 @@ diff -ruwN source-old/src/meson.build source/src/meson.build
else
wayland_scanner_for_build = wayland_scanner
endif
diff -ruwN source-old/src/wayland-os.c source/src/wayland-os.c
--- source-old/src/wayland-os.c 2025-07-06 13:11:26.000000000 +0100
+++ source/src/wayland-os.c 2026-04-14 19:30:00.000000000 +0100
@@ -134,11 +134,13 @@
{
int newfd;
+ #if defined(F_DUPFD_CLOEXEC)
newfd = wl_fcntl(fd, F_DUPFD_CLOEXEC, minfd);
if (newfd >= 0)
return newfd;
if (errno != EINVAL)
return -1;
+ #endif
newfd = wl_fcntl(fd, F_DUPFD, minfd);
return set_cloexec_or_close(newfd);