[PATCH v3] linux: Fix stat layout divergence under pre-POSIX.1-2008 macros [BZ #32119]

Matthias Goergens matthias.goergens@gmail.com
Wed Sep 30 03:28:35 GMT 2026


Hi Adhemerval,

The code in v3 is the same as the squashed commit I checked in August
[1]; only the commit message is new.

I applied it to master (30f988fbe795).  On native x86_64 and i686,
make check for io, misc, posix and conform shows no failures.  I also
ran the new test through its Makefile rule with glibc configured for
real cross compilers (Debian's, plus build-many-glibcs.py for or1k,
csky and microblazeel): 17 configurations covering i686, arm, powerpc,
mips and mipsel (o32 and n32), riscv32, arc, or1k, m68k, sh4, hppa,
sparcv9, csky and microblazeel.  It passes on all of them, and against
the unpatched headers it fails on all but riscv32, so it catches the
bug.  Beyond the test, sizeof and every member offset of struct stat
and struct stat64 match the _GNU_SOURCE layout in all 13 feature-test
modes I tried, and the size table in the commit message is right.

One correction to my August mail: or1k aligns 64-bit types to 4
bytes, not 8, so before the fix its strict-mode layout was 116 bytes,
as on arc and as your table says.

Small points, none blocking:

- The commit message says the missing <bits/endian.h> displaces the
  nanosecond fields on mips o32/n32.  That only happens on
  little-endian mips ("mipsel o32/n32"); big-endian mips only changes
  size.

- The sentence ending "the big-endian member order is selected" lost
  the "they compare equal, and" from the August wording.

- tst-stat-layout-time64.py: "#otherwise" is missing a space.

Tested-by: Matthias Goergens <matthias.goergens@gmail.com>

Thanks,
Matthias

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=ecf95727a78731465b33290bc7374114ab38b63e


More information about the Libc-alpha mailing list