From 4467eafffdfd9608a049093dc2be5a45aada7e5e Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 2 Aug 2024 06:13:23 +0100 Subject: [PATCH] build: mamake: rm include (re: ced499a3) On 32-bit Linux systems, as soon as mamake was relinked against libast, the libast version of fseeko(3) was displaying some really weird undefined behaviour, breaking the 'loop' command. The culprit was the include. The problem went away as soon as that was removed. assert.h was included before libast to avoid a compilation failure on some other systems, but including it before libast evidently breaks libast -- it looks like it may pull in parts of Stdio that libast (which reimplements Stdio in terms of Sfio) does not have a chance to override, so the two get mixed in breaking ways. I'd never seen assert.h combined with libast code before I used it in mamake; now I know why :-/ src/cmd/INIT/mamake.c: - Remove the include. - Define assert(c) as a simplistic 'if (!(c)) abort()'. There won't be a message if it goes wrong, but that's no big deal; we'll just have to follow the stack trace. --- src/cmd/INIT/mamake.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/INIT/mamake.c b/src/cmd/INIT/mamake.c index c20164564b3c..0a577c9697d1 100644 --- a/src/cmd/INIT/mamake.c +++ b/src/cmd/INIT/mamake.c @@ -30,8 +30,6 @@ #define RELEASE_DATE "2024-08-01" static char id[] = "\n@(#)$Id: mamake (ksh 93u+m) " RELEASE_DATE " $\0\n"; -#include - #if _PACKAGE_ast #include @@ -165,6 +163,9 @@ static const char usage[] = #include #endif +/* standard assert.h does not play well with libast headers on too many systems */ +#define assert(c) if(!(c)) abort() + /* backward compat for file offsets */ #if _POSIX_VERSION < 200112L #define off_t long