public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "benjamin.grossschartner at urbanandmainlines dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/32119] New: struct stat has different size depending on _POSIX_C_SOURCE
Date: Tue, 27 Aug 2024 10:38:20 +0000	[thread overview]
Message-ID: <bug-32119-131@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=32119

            Bug ID: 32119
           Summary: struct stat has different size depending on
                    _POSIX_C_SOURCE
           Product: glibc
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: benjamin.grossschartner at urbanandmainlines dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

On 32bit architectures with 64bit time enabled, struct stat misses the
"__glibc_reserved" fields, if a POSIX version < 2008 is used.

As these reserved fields are also part of the struct used by the linux kernel,
it seems that this is a bug in the glibc headers.

The bug was introduced by:
4e8521333bea6e89fcef1020e59a5f799241c5d4

The last "#endif" in the file
"sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h" was missplaced.
In all other definitions of "struct stat" this "#ifdef __USE_XOPEN2K8" only
controls the handling of the time structs, but not these reserved fields.


Suggested fix:

diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h
b/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h
index 9ded57aa..124d0b59 100644                                                 
--- a/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h                  
+++ b/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h                  
@@ -58,9 +58,8 @@                                                               
   __fieldts64 (st_atime);                                                      
   __fieldts64 (st_mtime);                                                      
   __fieldts64 (st_ctime);                                                      
+# undef __fieldts64                                                            
+#endif                                                                         

   unsigned long int __glibc_reserved4;                                         
   unsigned long int __glibc_reserved5;                                         
-                                                                               
-# undef __fieldts64                                                            
-#endif

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2024-08-27 10:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 10:38 benjamin.grossschartner at urbanandmainlines dot com [this message]
2024-08-27 12:52 ` [Bug libc/32119] " sam at gentoo dot org
2024-08-27 12:52 ` sam at gentoo dot org
2024-09-03 19:39 ` adhemerval.zanella at linaro dot org
2024-09-11 13:57 ` schwab@linux-m68k.org
2024-09-11 17:06 ` fweimer at redhat dot com
2024-09-12 19:50 ` adhemerval.zanella at linaro dot org
2024-09-13 11:30 ` carlos at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-32119-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).