[PATCH v2] io: Do not alias fts and fts64 when inode types differ
Magnus Lindholm
linmag7@gmail.com
Sun Aug 9 12:40:32 GMT 2026
The fts and fts64 interfaces can share an implementation only when
both their offset and inode types have matching layouts.
The existing conditions check only whether off_t and off64_t match.
On Alpha, these types match, but ino_t and ino64_t differ.
Consequently, FTSENT and FTSENT64 have different layouts.
The ordinary fts implementation is therefore omitted on Alpha, and
the ordinary fts symbols are instead aliased to the fts64
implementation. This causes the ordinary interface to operate on an
incompatible FTSENT64 layout and corrupts traversal state.
Build the ordinary implementation unless both the offset and inode
types match. Likewise, alias the ordinary symbols to the fts64
implementation only when both types match.
An audit of the bits/typesizes.h implementations shows that Alpha is
the only ABI where __OFF_T_MATCHES_OFF64_T is defined but
__INO_T_MATCHES_INO64_T is not. Therefore, this changes the
implementation selection only on Alpha.
This fixes io/tst-fts, io/tst-fts-bz22944, and io/tst-fts-newflags on
Alpha.
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
Changes in v2:
- Drop the Alpha-specific fts.c and fts64.c wrappers, which are no
longer needed after b9a2dea54abd.
- Audit bits/typesizes.h implementations. Alpha is the only ABI where
__OFF_T_MATCHES_OFF64_T is defined without
__INO_T_MATCHES_INO64_T.
Tested on alpha-linux-gnu (ES40):
PASS: io/tst-fts
PASS: io/tst-fts-bz22944
PASS: io/tst-fts-newflags
The complete io testsuite reports 79 PASS and 2 UNSUPPORTED, with no
failures.
v1: https://inbox.sourceware.org/libc-alpha/20260803190118.3090469-1-linmag7@gmail.com/
io/fts.c | 3 ++-
io/fts64.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/io/fts.c b/io/fts.c
index d3b8e5a100..c7df552b83 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
-#ifndef __OFF_T_MATCHES_OFF64_T
+#if !defined __OFF_T_MATCHES_OFF64_T \
+ || !defined __INO_T_MATCHES_INO64_T
# include "io/fts-common.c"
#endif
diff --git a/io/fts64.c b/io/fts64.c
index 1efa06ab3b..c2cf45523e 100644
--- a/io/fts64.c
+++ b/io/fts64.c
@@ -50,7 +50,8 @@ weak_alias (__fts64_read, fts64_read)
weak_alias (__fts64_set, fts64_set)
weak_alias (__fts64_children, fts64_children)
-#ifdef __OFF_T_MATCHES_OFF64_T
+#if defined __OFF_T_MATCHES_OFF64_T \
+ && defined __INO_T_MATCHES_INO64_T
weak_alias (__fts64_open, fts_open)
weak_alias (__fts64_close, fts_close)
weak_alias (__fts64_read, fts_read)
--
2.55.0
More information about the Libc-alpha
mailing list