Hi Pádraig,
On AIX the following test fails:
$ make TESTS=tests/misc/stdbuf.sh check
[...]
FAIL: tests/misc/stdbuf.sh
[...]
This is because AIX does not support the LD_PRELOAD environment
variable. Copying the text from their docs [1]:
The LDR_PRELOAD and LDR_PRELOAD64 environment variables make it
possible for a process to preload shared libraries. The LDR_PRELOAD
environment variable is for 32-bit processes, and the LDR_PRELOAD64
environment variable is for 64-bit processes.
The attached patch fixes it.
Not sure if this warrants a NEWS entry. I'll let you decide.
Collin
[1]
https://www.ibm.com/docs/en/aix/7.3.0?topic=techniques-preloaded-shared-libraries
>From ab3a7c93c5e4dd40f998e944b52e7de1d2f50390 Mon Sep 17 00:00:00 2001
Message-ID: <ab3a7c93c5e4dd40f998e944b52e7de1d2f50390.1750643298.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sun, 22 Jun 2025 18:13:36 -0700
Subject: [PATCH] stdbuf: support AIX
* src/stdbuf.c (set_LD_PRELOAD): Use the AIX specific environment
variables LDR_PRELOAD or LDR_PRELOAD64.
---
src/stdbuf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/stdbuf.c b/src/stdbuf.c
index ba4246838..9fa9d01f4 100644
--- a/src/stdbuf.c
+++ b/src/stdbuf.c
@@ -192,6 +192,9 @@ set_LD_PRELOAD (void)
int ret;
#ifdef __APPLE__
char const *preload_env = "DYLD_INSERT_LIBRARIES";
+#elif defined _AIX
+ char const *preload_env = (sizeof (void *) < 8
+ ? "LDR_PRELOAD" : "LDR_PRELOAD64");
#else
char const *preload_env = "LD_PRELOAD";
#endif
--
2.49.0