Proof of concept mechanical port of ircnet/ircd to Rust as part of a bit about C being insecure for network services
0

Configure Feed

Select the types of activity you want to include in your feed.

ircd.rs / docs / claude-memory / support-irc-memcmp-host-gated.md
2.1 kB

name: support-irc-memcmp-host-gated description: "support_diff link-failed (cref_irc_memcmp) — irc_memcmp host-gated behind MEMCMP_BROKEN; FIXED 2026-06-04 via have_cref_irc_memcmp cfg" metadata: node_type: memory type: project originSessionId: 620818cc-9169-481f-9817-0bf646a7c452#

RESOLVED 2026-06-04 (commits 38c7dd8e build.rs + e128cc6d test). support_diff now links and passes (5 tests; irc_memcmp_matches_reference gated out on this host). What follows is the diagnosis kept for context.

cargo test -p ircd-testkit --test support_diff had been failing to link on this host (aarch64): undefined reference to cref_irc_memcmp. NOT a port regression.

Root cause: common/support.c:877-1197 wraps the whole irc_memcmp family in #if defined(HAVE_MEMCMP) && defined(MEMCMP_BROKEN). cbuild/setup.h has HAVE_MEMCMP 1 but MEMCMP_BROKEN is #undef (configure decided the native memcmp is fine), so support.o never defines irc_memcmp → the cref-oracle rename (ircd-testkit/build.rs, nmobjcopy --redefine-syms) produces no cref_irc_memcmp → the test that references it can't link. The Rust port (ircd-common/src/support.rs::irc_memcmp) is defined unconditionally so the link-set side (c_irc_memcmp) resolves; only the oracle side is missing. On this host irc_memcmp is also dead code (os.h's #define memcmp irc_memcmp is gated off too).

Fix applied: ircd-testkit/build.rs emits cargo:rustc-cfg=have_cref_irc_memcmp only when the rename map actually contains irc_memcmp (+ an always-on rustc-check-cfg); support_diff.rs gates the two irc_memcmp externs and the irc_memcmp_matches_reference test behind #[cfg(have_cref_irc_memcmp)]. Keeps the case running on MEMCMP_BROKEN hosts; links everywhere else. Rejected: force -DMEMCMP_BROKEN on the oracle's support.o (would redirect every in-TU memcmp call to irc_memcmp, diverging the oracle from "the C as actually configured").

Sibling host-portability gotcha fixed the same day: [[s-user-umode-diff-broken]].