Re: [PATCH v3] io: fix ftw ABI on MIPS n64

"Andreas K. Huettel" <[email protected]> Fri, 24 Jul 2026 19:16:14 +0900
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo Linux
Message-ID <[email protected]>
OK so at this point, no matter how simple it looks, I'd rather have mips n64 
(slightly) broken without a backport than risk breaking more by pushing a 
last-minute change with insufficient testing.

Unless there's a huge protest I'll go ahead with the release in a few hours.

Cheers,
Andreas


Am Mittwoch, 22. Juli 2026, 20:26:10 Japanische Normalzeit schrieb Xi Ruoyao:
> On MIPS n64 off_t is same as off64_t, but struct stat is not same as
> struct stat64 (very peculiar but see the "as tempting as it..." comment
> in linux/mips/kernel_stat.h).  As the ftw/ftw64 callback accepts a
> pointer to a function who accepts struct stat/stat64, for MIPS n64 we
> must use different implementations for ftw and ftw64.
> 
> Thus for testing if ftw64 can be aliased to ftw, we should check
> XSTAT_IS_XSTAT64 instead of __OFF_T_MATCHES_OFF64_T.
> 
> This resolves the io/tst-ftw-lnk failure observed on MIPS n64.
> 
> Link: https://sourceware.org/glibc/wiki/Testing/Tests/io/tst-ftw-lnk
> Signed-off-by: Xi Ruoyao <[email protected]>
> ---
> 
> Change from v2: retain/add sys/types.h inclusion as some targets need
> struct timespec definition in kernel_stat.h.
> 
> Tested on x86_64-linux, mips64-linux, and i686-linux.
> 
>  io/ftw.c   | 4 +++-
>  io/ftw64.c | 5 ++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/io/ftw.c b/io/ftw.c
> index ed0eeb3904..a9368a706e 100644
> --- a/io/ftw.c
> +++ b/io/ftw.c
> @@ -18,7 +18,9 @@
>  
>  #include <sys/types.h>
>  
> -#ifndef __OFF_T_MATCHES_OFF64_T
> +#include <kernel_stat.h>
> +
> +#if !XSTAT_IS_XSTAT64
>  # include "ftw-common.c"
>  
>  versioned_symbol (libc, __new_nftw, nftw, GLIBC_2_3_3);
> diff --git a/io/ftw64.c b/io/ftw64.c
> index d3cd14c21a..fa7b05df22 100644
> --- a/io/ftw64.c
> +++ b/io/ftw64.c
> @@ -31,6 +31,9 @@
>  #define ftw __rename_ftw
>  #define nftw __rename_nftw
>  
> +#include <sys/types.h>
> +
> +#include <kernel_stat.h>
>  #include <shlib-compat.h>
>  #include "ftw-common.c"
>  
> @@ -44,7 +47,7 @@ versioned_symbol (libc, __new_nftw64, nftw64, GLIBC_2_3_3);
>  compat_symbol (libc, __old_nftw64, nftw64, GLIBC_2_1);
>  #endif
>  
> -#ifdef __OFF_T_MATCHES_OFF64_T
> +#if XSTAT_IS_XSTAT64
>  weak_alias (__ftw64, ftw)
>  versioned_symbol (libc, __new_nftw64, nftw, GLIBC_2_3_3);
>  # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_3_3)
> 


-- 
PD Dr. Andreas K. Hüttel
[email protected]
Gentoo Linux developer 
(council, comrel, toolchain, base-system, perl, libreoffice)
https://wiki.gentoo.org/wiki/User:Dilfridge
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEE/Rnm0xsZLuTcY+rT3CsWIV7VQSoFAmpjO24bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJENwrFiFe1UEqcR8QALFn66Lj08cY/kLuWpSR
beeSNqMkd0/uciei7+msdfzvHmyQo9eO0VFvmSqupnqL4/yKgqtP3uh7oK61YqPv
Pbj2VS665fe5XkORNrbv1YZhDzu84+XS9N/R95UqLeNj1JviXXfRnkbZ1rAQTIgk
aoArPxs4n6FSHDevJnm+nXcYG2uR0jOOXfvK5qngDg1TOsWGOJyRtRtmpgRivZxN
I+QCJdB4yEpc9uhM3VwxfN5L7h5k9K2PQ+sj4GoTMYjaUc91Pc9WmgKyTaH6vXmq
+gonFDU0FQx0kUuq9XIuQwuasbxk44VDyE0oiKr09ad7xD2ZD5mUDHD+xrj/qJDi
SCJyF8c14tJdHsIZLxzGWG8NFAhtjXJ9gwwCkGg80de7SGIrQ93ZDqfcRm4mP2M+
L4Z5i5jgLdcaayOa6FzueVWxFNJjayPyALqOB/sWObhEknCTT1yG2LmzscolQ48J
7EmtunvO8aa8YkZXiM461EAgBHuot8A5TnDSGuE4ASbjM7jaKZCPemtBcaZLmcRW
0dL7l2PyqM5Pd3xiiDOMRKxlmVCfwHvkDSS6U6lpbMOlyR7oobB5R4xKhey+TJJO
KIU+PlCBfVkPKxAIO6ROxdEFg/5Y9WZ8dpAnYKZdcMeuCXDDpsPyglPvS8/pfVgu
T0oVKOJFoxOuvDUvN6NnjFiE
=qocQ
-----END PGP SIGNATURE-----