Skip to contentSkip to conversation

package/uclibc: fix missing m_tim issue

PATCH Applied Waldemar Brodkorb 2 participants 6 messages Aug 5, 2024 – Aug 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/uclibc: fix missing m_tim issue

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

---
v1->v2:
- add missing autobuild url (requested by Thomas P.)

---
 ...are-st_mtim-if-defined-__USE_XOPEN2K.patch | 205 ++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch
package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch new file +205 -0
new file mode 100644
index 0000000000..9b1003a036
@@ -0,0 +1,205 @@
+From d0c8c185b439187b12644457bb2aa0326f25aaf7 Mon Sep 17 00:00:00 2001
+From: J.Neuschäfer?= <[email protected]>
+Date: Sat, 27 Jul 2024 18:47:09 +0200
+Subject: [PATCH] bits/stat.h: Declare st_mtim if defined(__USE_XOPEN2K8),
+ everywhere
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+While building software that sets _POSIX_C_SOURCE=200809L and uses
+stat.st_mtim for ARM, it was noticed that st_mtim was not defined.
+
+This seems to be because common/bits/stat.h was picked up, which does
+not take __USE_XOPEN2K8 as a reason to enable st_mtim and related
+fields. This appears to be an oversight, and porting the check from
+common-generic/bits/stat.h to other architectures does indeed fix the
+build issue.
+
+This patch is based on commit 50bd6d06e ("Fix memory corruption due to
+struct stat field").
+
+Signed-off-by: J. Neuschäfer <[email protected]>
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+Upstream: https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=d0c8c185b439187b12644457bb2aa0326f25aaf7
+---
+ libc/sysdeps/linux/alpha/bits/stat.h   | 2 +-
+ libc/sysdeps/linux/common/bits/stat.h  | 4 ++--
+ libc/sysdeps/linux/frv/bits/stat.h     | 4 ++--
+ libc/sysdeps/linux/ia64/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/m68k/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/mips/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/nds32/bits/stat.h   | 4 ++--
+ libc/sysdeps/linux/powerpc/bits/stat.h | 4 ++--
+ 8 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/libc/sysdeps/linux/alpha/bits/stat.h b/libc/sysdeps/linux/alpha/bits/stat.h
+index 88bc6617d..f2dca250d 100644
+--- a/libc/sysdeps/linux/alpha/bits/stat.h
++++ b/libc/sysdeps/linux/alpha/bits/stat.h
+@@ -40,7 +40,7 @@
+ 
+    Use neat tidy anonymous unions and structures when possible.  */
+ 
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+ # if __GNUC_PREREQ(3,3)
+ #  define __ST_TIME(X)				\
+ 	__extension__ union {			\
+diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h
+index 07c09f50a..fc76cc3e7 100644
+--- a/libc/sysdeps/linux/common/bits/stat.h
++++ b/libc/sysdeps/linux/common/bits/stat.h
+@@ -61,7 +61,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -107,7 +107,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/frv/bits/stat.h b/libc/sysdeps/linux/frv/bits/stat.h
+index 381d207f2..18321c080 100644
+--- a/libc/sysdeps/linux/frv/bits/stat.h
++++ b/libc/sysdeps/linux/frv/bits/stat.h
+@@ -70,7 +70,7 @@ struct stat
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+ 
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -117,7 +117,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/ia64/bits/stat.h b/libc/sysdeps/linux/ia64/bits/stat.h
+index 6723166e7..2b70b8cf8 100644
+--- a/libc/sysdeps/linux/ia64/bits/stat.h
++++ b/libc/sysdeps/linux/ia64/bits/stat.h
+@@ -38,7 +38,7 @@ struct stat
+     int pad0;
+     __dev_t st_rdev;		/* Device number, if device.  */
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -77,7 +77,7 @@ struct stat64
+     int pad0;
+     __dev_t st_rdev;		/* Device number, if device.  */
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h
+index 7b9c3d144..70da1b384 100644
+--- a/libc/sysdeps/linux/m68k/bits/stat.h
++++ b/libc/sysdeps/linux/m68k/bits/stat.h
+@@ -60,7 +60,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -106,7 +106,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
+index 539fa33d2..bad2a0244 100644
+--- a/libc/sysdeps/linux/mips/bits/stat.h
++++ b/libc/sysdeps/linux/mips/bits/stat.h
+@@ -60,7 +60,7 @@ struct stat
+     long int st_pad2[2];
+     __off64_t st_size;		/* Size of file, in bytes.  */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -103,7 +103,7 @@ struct stat {
+     unsigned int st_rdev;	/* Device number, if device.  */
+     int st_pad2[3];
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/nds32/bits/stat.h b/libc/sysdeps/linux/nds32/bits/stat.h
+index c4e09e0f2..5272751f4 100644
+--- a/libc/sysdeps/linux/nds32/bits/stat.h
++++ b/libc/sysdeps/linux/nds32/bits/stat.h
+@@ -64,7 +64,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -110,7 +110,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h
+index 7494586b5..ce2ebf896 100644
+--- a/libc/sysdeps/linux/powerpc/bits/stat.h
++++ b/libc/sysdeps/linux/powerpc/bits/stat.h
+@@ -59,7 +59,7 @@ struct stat
+ # else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ # endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -99,7 +99,7 @@ struct stat64
+     __off64_t st_size;			/* Size of file, in bytes.  */
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+-- 
+2.30.2
+
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 5 lines · On Mon, 5 Aug 2024 08:20:04 +0200 Waldemar Brodkorb <[email protected]> wrote:

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

Quoted 8 lines

---
v1->v2:
- add missing autobuild url (requested by Thomas P.)

---
 ...are-st_mtim-if-defined-__USE_XOPEN2K.patch | 205 ++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Waldemar Brodkorb

Hi Waldemar,

Quoted 4 lines · Waldemar Brodkorb

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

The autobuilder started showing failures like:

In file included from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/sys/stat.h:106,

                 from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/fcntl.h:37,
                 from libslack/fio.c:72:
/home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bits/stat.h:201:9: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
  201 |     int st_atime;
      |         ^~~~~~~~

This is from
http://autobuild.buildroot.net/results/f3b3942b6b645d9523ab08d179a3f8aca7d6641c/

Is this patch related to that issue?

Thanks,
baruch

Quoted 221 lines

---
v1->v2:
- add missing autobuild url (requested by Thomas P.)

---
 ...are-st_mtim-if-defined-__USE_XOPEN2K.patch | 205 ++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch
package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch new file +205 -0
new file mode 100644
index 0000000000..9b1003a036
@@ -0,0 +1,205 @@
+From d0c8c185b439187b12644457bb2aa0326f25aaf7 Mon Sep 17 00:00:00 2001
+From: J.Neuschäfer?= <[email protected]>
+Date: Sat, 27 Jul 2024 18:47:09 +0200
+Subject: [PATCH] bits/stat.h: Declare st_mtim if defined(__USE_XOPEN2K8),
+ everywhere
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+While building software that sets _POSIX_C_SOURCE=200809L and uses
+stat.st_mtim for ARM, it was noticed that st_mtim was not defined.
+
+This seems to be because common/bits/stat.h was picked up, which does
+not take __USE_XOPEN2K8 as a reason to enable st_mtim and related
+fields. This appears to be an oversight, and porting the check from
+common-generic/bits/stat.h to other architectures does indeed fix the
+build issue.
+
+This patch is based on commit 50bd6d06e ("Fix memory corruption due to
+struct stat field").
+
+Signed-off-by: J. Neuschäfer <[email protected]>
+Signed-off-by: Waldemar Brodkorb <[email protected]>
+Upstream: https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=d0c8c185b439187b12644457bb2aa0326f25aaf7
+---
+ libc/sysdeps/linux/alpha/bits/stat.h   | 2 +-
+ libc/sysdeps/linux/common/bits/stat.h  | 4 ++--
+ libc/sysdeps/linux/frv/bits/stat.h     | 4 ++--
+ libc/sysdeps/linux/ia64/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/m68k/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/mips/bits/stat.h    | 4 ++--
+ libc/sysdeps/linux/nds32/bits/stat.h   | 4 ++--
+ libc/sysdeps/linux/powerpc/bits/stat.h | 4 ++--
+ 8 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/libc/sysdeps/linux/alpha/bits/stat.h b/libc/sysdeps/linux/alpha/bits/stat.h
+index 88bc6617d..f2dca250d 100644
+--- a/libc/sysdeps/linux/alpha/bits/stat.h
++++ b/libc/sysdeps/linux/alpha/bits/stat.h
+@@ -40,7 +40,7 @@
+ 
+    Use neat tidy anonymous unions and structures when possible.  */
+ 
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+ # if __GNUC_PREREQ(3,3)
+ #  define __ST_TIME(X)				\
+ 	__extension__ union {			\
+diff --git a/libc/sysdeps/linux/common/bits/stat.h b/libc/sysdeps/linux/common/bits/stat.h
+index 07c09f50a..fc76cc3e7 100644
+--- a/libc/sysdeps/linux/common/bits/stat.h
++++ b/libc/sysdeps/linux/common/bits/stat.h
+@@ -61,7 +61,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -107,7 +107,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/frv/bits/stat.h b/libc/sysdeps/linux/frv/bits/stat.h
+index 381d207f2..18321c080 100644
+--- a/libc/sysdeps/linux/frv/bits/stat.h
++++ b/libc/sysdeps/linux/frv/bits/stat.h
+@@ -70,7 +70,7 @@ struct stat
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+ 
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -117,7 +117,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/ia64/bits/stat.h b/libc/sysdeps/linux/ia64/bits/stat.h
+index 6723166e7..2b70b8cf8 100644
+--- a/libc/sysdeps/linux/ia64/bits/stat.h
++++ b/libc/sysdeps/linux/ia64/bits/stat.h
+@@ -38,7 +38,7 @@ struct stat
+     int pad0;
+     __dev_t st_rdev;		/* Device number, if device.  */
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -77,7 +77,7 @@ struct stat64
+     int pad0;
+     __dev_t st_rdev;		/* Device number, if device.  */
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h
+index 7b9c3d144..70da1b384 100644
+--- a/libc/sysdeps/linux/m68k/bits/stat.h
++++ b/libc/sysdeps/linux/m68k/bits/stat.h
+@@ -60,7 +60,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -106,7 +106,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
+index 539fa33d2..bad2a0244 100644
+--- a/libc/sysdeps/linux/mips/bits/stat.h
++++ b/libc/sysdeps/linux/mips/bits/stat.h
+@@ -60,7 +60,7 @@ struct stat
+     long int st_pad2[2];
+     __off64_t st_size;		/* Size of file, in bytes.  */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -103,7 +103,7 @@ struct stat {
+     unsigned int st_rdev;	/* Device number, if device.  */
+     int st_pad2[3];
+     __off_t st_size;		/* Size of file, in bytes.  */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/nds32/bits/stat.h b/libc/sysdeps/linux/nds32/bits/stat.h
+index c4e09e0f2..5272751f4 100644
+--- a/libc/sysdeps/linux/nds32/bits/stat.h
++++ b/libc/sysdeps/linux/nds32/bits/stat.h
+@@ -64,7 +64,7 @@ struct stat
+ #else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ #endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -110,7 +110,7 @@ struct stat64
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+ 
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+diff --git a/libc/sysdeps/linux/powerpc/bits/stat.h b/libc/sysdeps/linux/powerpc/bits/stat.h
+index 7494586b5..ce2ebf896 100644
+--- a/libc/sysdeps/linux/powerpc/bits/stat.h
++++ b/libc/sysdeps/linux/powerpc/bits/stat.h
+@@ -59,7 +59,7 @@ struct stat
+ # else
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+ # endif
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+@@ -99,7 +99,7 @@ struct stat64
+     __off64_t st_size;			/* Size of file, in bytes.  */
+     __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+     __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+-#ifdef __USE_MISC
++#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
+     /* Nanosecond resolution timestamps are stored in a format
+        equivalent to 'struct timespec'.  This is the type used
+        whenever possible but the Unix namespace rules do not allow the
+-- 
+2.30.2
+
Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hi Baruch,
Baruch Siach wrote,

Quoted 17 lines

Hi Waldemar,

Quoted 4 lines · Waldemar Brodkorb

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

The autobuilder started showing failures like:

In file included from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/sys/stat.h:106,

                 from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/fcntl.h:37,
                 from libslack/fio.c:72:
/home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bits/stat.h:201:9: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
  201 |     int st_atime;
      |         ^~~~~~~~
Quoted 4 lines

This is from
http://autobuild.buildroot.net/results/f3b3942b6b645d9523ab08d179a3f8aca7d6641c/

Is this patch related to that issue?

Good catch. It is related, I removed the patch and then the compile works. But I don't understand why it fails.
@J.: Do you see why it fails for mips64el (n32)?

best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
Quoted 20 lines · Waldemar Brodkorb

Hi Baruch,
Baruch Siach wrote,

Quoted 17 lines

Hi Waldemar,

Quoted 4 lines · Waldemar Brodkorb

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

The autobuilder started showing failures like:

In file included from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/sys/stat.h:106,

                 from /home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/fcntl.h:37,
                 from libslack/fio.c:72:
/home/autobuild/autobuild/instance-12/output-1/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/bits/stat.h:201:9: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
  201 |     int st_atime;
      |         ^~~~~~~~
Quoted 8 lines
Quoted 4 lines

This is from
http://autobuild.buildroot.net/results/f3b3942b6b645d9523ab08d179a3f8aca7d6641c/

Is this patch related to that issue?

Good catch. It is related, I removed the patch and then the compile works. But I don't understand why it fails.
@J.: Do you see why it fails for mips64el (n32)?

I found the issue: In the per-architecture stat.h files that I patched, there are sections like:

#ifdef __USE_MISC
/* Nanosecond resolution timestamps are stored [...] */
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif

I tried to change all instances of "#ifdef __USE_MISC" to "#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)", but I missed some, because MIPS has four of them (for the different ABI variants), and I patched only the first two.

I think my original patch is salvageable, but it needs a follow-up for MIPS and a few other architectures:

	$ find libc/sysdeps/ -name stat.h | xargs grep __USE_MISC
	libc/sysdeps/linux/sparc64/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/sparc64/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/common-generic/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/common-generic/bits/stat.h:# if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/powerpc/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/powerpc/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/m68k/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/m68k/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/x86_64/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/x86_64/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/mips/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/mips/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/mips/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/mips/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/common/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/common/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/sparc/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/sparc/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/nds32/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/nds32/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/xtensa/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/xtensa/bits/stat.h:#ifdef __USE_MISC
	libc/sysdeps/linux/ia64/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/ia64/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/kvx/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/kvx/bits/stat.h:# if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/alpha/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/frv/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)
	libc/sysdeps/linux/frv/bits/stat.h:#if defined(__USE_MISC) || defined(__USE_XOPEN2K8)

I'll see when I get around to sending the follow-up patch.

-- jn
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Waldemar Brodkorb
Quoted 5 lines · On Mon, 5 Aug 2024 08:20:04 +0200 Waldemar Brodkorb <[email protected]> wrote:

Patch from upstream to fix missing m_tim issue.

Fixes:
- http://autobuild.buildroot.org/results/f07d6d6ae2331f9972974093c0503b9d3c6b914a/

Quoted 8 lines

---
v1->v2:
- add missing autobuild url (requested by Thomas P.)

---
 ...are-st_mtim-if-defined-__USE_XOPEN2K.patch | 205 ++++++++++++++++++
 1 file changed, 205 insertions(+)
 create mode 100644 package/uclibc/0003-bits-stat.h-Declare-st_mtim-if-defined-__USE_XOPEN2K.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot