mirror of
https://git.yoctoproject.org/poky
synced 2026-04-14 08:02:30 +02:00
libc-test: Fix strptime and api/main tests
(From OE-Core rev: 124921683e9a0a1d981eaeea717c5dd7d35abf90) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
From df26c5206c3234fd2df924cff7ef540af1f2077c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 19 Aug 2025 23:11:40 -0700
|
||||
Subject: [PATCH libc-test] Fix strptime on musl
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
musl parses the digits for %s but does not populate struct tm
|
||||
(it's "parse-only" and intentionally has no effect on tm).
|
||||
That's why you get a zeroed-out date like 1900-01-00T00:00:00.
|
||||
This is current upstream behavior:
|
||||
|
||||
case 's': /* Parse only. Effect on tm is unspecified and presently no effect is implemented.. */
|
||||
|
||||
musl's strptime only accepts ±hhmm for %z (e.g., -0600).
|
||||
It does not accept ±hh or ±hh:mm. So '-06' fails by design.
|
||||
It can be seen that upstream only checks 4 digits after the sign.
|
||||
|
||||
Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/08/20/2]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
AUTHORS | 1 +
|
||||
src/functional/strptime.c | 4 +++-
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/AUTHORS b/AUTHORS
|
||||
index cf2a394..5e78ef7 100644
|
||||
--- a/AUTHORS
|
||||
+++ b/AUTHORS
|
||||
@@ -6,3 +6,4 @@ Jens Gustedt
|
||||
Alexander Monakov
|
||||
Julien Ramseier
|
||||
Alyssa Ross
|
||||
+Khem Raj
|
||||
diff --git a/src/functional/strptime.c b/src/functional/strptime.c
|
||||
index b5f8977..f76fa68 100644
|
||||
--- a/src/functional/strptime.c
|
||||
+++ b/src/functional/strptime.c
|
||||
@@ -109,10 +109,12 @@ int main() {
|
||||
|
||||
/* Glibc */
|
||||
checkStrptime("1856-07-10", "%F", &tm4);
|
||||
+#ifdef __GLIBC__
|
||||
checkStrptime("683078400", "%s", &tm2);
|
||||
+#endif
|
||||
checkStrptimeTz("+0200", 2, 0);
|
||||
checkStrptimeTz("-0530", -5, -30);
|
||||
- checkStrptimeTz("-06", -6, 0);
|
||||
+ checkStrptimeTz("-0600", -6, 0);
|
||||
|
||||
return t_status;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
From 90515d553d03d1f0bec8a4bdf03d02626d3968bb Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 19 Aug 2025 23:32:52 -0700
|
||||
Subject: [PATCH] api/unistd: guard optional/obsolete *_PC/*_SC constants for
|
||||
musl
|
||||
|
||||
musl does not define some POSIX option macros:
|
||||
- _SC_XOPEN_UUCP is obsolete and absent on musl
|
||||
- _PC_TIMESTAMP_RESOLUTION is optional and may be undefined
|
||||
|
||||
Build currently fails when these are referenced unconditionally.
|
||||
Wrap the checks in #ifdef so the test compiles on musl without
|
||||
claiming support for unavailable names.
|
||||
|
||||
Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2025/08/20/3]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
src/api/unistd.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/api/unistd.c b/src/api/unistd.c
|
||||
index 522ccdc..0de547b 100644
|
||||
--- a/src/api/unistd.c
|
||||
+++ b/src/api/unistd.c
|
||||
@@ -114,7 +114,9 @@ C(_PC_REC_MIN_XFER_SIZE)
|
||||
C(_PC_REC_XFER_ALIGN)
|
||||
C(_PC_SYMLINK_MAX)
|
||||
C(_PC_SYNC_IO)
|
||||
+#ifdef _PC_TIMESTAMP_RESOLUTION
|
||||
C(_PC_TIMESTAMP_RESOLUTION)
|
||||
+#endif
|
||||
C(_PC_VDISABLE)
|
||||
C(_SC_2_C_BIND)
|
||||
C(_SC_2_C_DEV)
|
||||
@@ -235,7 +237,9 @@ C(_SC_XOPEN_REALTIME_THREADS)
|
||||
C(_SC_XOPEN_SHM)
|
||||
C(_SC_XOPEN_STREAMS)
|
||||
C(_SC_XOPEN_UNIX)
|
||||
+#ifdef _SC_XOPEN_UUCP
|
||||
C(_SC_XOPEN_UUCP)
|
||||
+#endif
|
||||
C(_SC_XOPEN_VERSION)
|
||||
C(STDERR_FILENO)
|
||||
C(STDIN_FILENO)
|
||||
@@ -12,6 +12,8 @@ inherit ptest
|
||||
SRCREV = "f2bac7711bec93467b73bec1465579ea0b8d5071"
|
||||
SRC_URI = " \
|
||||
git://repo.or.cz/libc-test;branch=master;protocol=https \
|
||||
file://0001-Fix-strptime-on-musl.patch \
|
||||
file://0001-api-unistd-guard-optional-obsolete-_PC-_SC-constants.patch \
|
||||
file://run-ptest \
|
||||
file://run-libc-ptests \
|
||||
"
|
||||
@@ -33,8 +35,10 @@ RDEPENDS:${PN} = " \
|
||||
|
||||
RDEPENDS:${PN}-ptest = " \
|
||||
${PN} \
|
||||
locale-base-en-us \
|
||||
musl-staticdev \
|
||||
sed \
|
||||
tzdata \
|
||||
"
|
||||
|
||||
install_path = "/opt/${PN}"
|
||||
|
||||
Reference in New Issue
Block a user