From: Hemanth.KumarMD@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: Sundeep.Kokkonda@windriver.com, Hemanth.KumarMD@windriver.com
Subject: [PATCH v4 7/8] glib-2.0: fix gdatetime ptest failure with glibc 2.43
Date: Thu, 12 Mar 2026 09:10:22 -0700 [thread overview]
Message-ID: <20260312161038.2578649-7-Hemanth.KumarMD@windriver.com> (raw)
In-Reply-To: <20260312161038.2578649-1-Hemanth.KumarMD@windriver.com>
From: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
glib/gdatetime.test ptest was failing after glibc 2.43 upgrade.
Backport upstream fix from glib commit 7c837a52.
Upstream: https://gitlab.gnome.org/GNOME/glib/-/issues/3895
Signed-off-by: Hemanth Kumar M D <Hemanth.KumarMD@windriver.com>
---
...tetime-ptest-failure-with-glibc-2.43.patch | 78 +++++++++++++++++++
meta/recipes-core/glib-2.0/glib.inc | 1 +
2 files changed, 79 insertions(+)
create mode 100644 meta/recipes-core/glib-2.0/files/0001-glib-2.0-fix-gdatetime-ptest-failure-with-glibc-2.43.patch
diff --git a/meta/recipes-core/glib-2.0/files/0001-glib-2.0-fix-gdatetime-ptest-failure-with-glibc-2.43.patch b/meta/recipes-core/glib-2.0/files/0001-glib-2.0-fix-gdatetime-ptest-failure-with-glibc-2.43.patch
new file mode 100644
index 0000000000..f023e687f4
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/files/0001-glib-2.0-fix-gdatetime-ptest-failure-with-glibc-2.43.patch
@@ -0,0 +1,78 @@
+From 7c837a520f51db74e482bc8196ed5ff40e432307 Mon Sep 17 00:00:00 2001
+From: Philip Withnall <pwithnall@gnome.org>
+Date: Mon, 23 Feb 2026 12:30:08 +0000
+Subject: [PATCH] gdatetime: Fix comparison against cached LC_TIME value
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The string pointer returned by `setlocale (LC_TIME, NULL)` may change if
+other code calls `setlocale()` again. But because internally glibc
+implements it using `strdup()`, the pointer value itself may actually
+stay the same even if the string contents change.
+
+This started happening more commonly in glibc 2.43, due to an internal
+`malloc()` change which happened to trigger this latent bug.
+
+In the situations where this happened, it resulted in an outdated cached
+era value being used.
+
+Fix it by taking a copy of the `LC_TIME` string. Unfortunately this
+means a reachable (‘leaked’) static string allocation at the end of the
+process’ life, but tooling should ignore that if we mark it with
+`g_ignore_leak()`.
+
+Debugged by Sam James, Wilco and Douglas R. Reno. See also
+https://sourceware.org/bugzilla/show_bug.cgi?id=33899#c6.
+
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/7c837a520f51db74e482bc8196ed5ff40e432307]
+
+Signed-off-by: Philip Withnall <pwithnall@gnome.org>
+Signed-off-by: Hemanth Kumar M D <hemanth.kumar.m.d@windriver.com>
+---
+ glib/gdatetime.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/glib/gdatetime.c b/glib/gdatetime.c
+index c4d7445432..8d67354cf2 100644
+--- a/glib/gdatetime.c
++++ b/glib/gdatetime.c
+@@ -65,6 +65,7 @@
+ #include <langinfo.h>
+ #endif
+
++#include "glib-private.h"
+ #include "gatomic.h"
+ #include "gcharset.h"
+ #include "gcharsetprivate.h"
+@@ -2981,14 +2982,14 @@ date_time_lookup_era (GDateTime *datetime,
+ {
+ static GMutex era_mutex;
+ static GPtrArray *static_era_description = NULL; /* (mutex era_mutex) (element-type GEraDescriptionSegment) */
+- static const char *static_era_description_locale = NULL; /* (mutex era_mutex) */
++ static char *static_era_description_locale = NULL; /* (mutex era_mutex) (owned) */
+ const char *current_lc_time = setlocale (LC_TIME, NULL);
+ GPtrArray *local_era_description; /* (element-type GEraDescriptionSegment) */
+ GEraDate datetime_date;
+
+ g_mutex_lock (&era_mutex);
+
+- if (static_era_description_locale != current_lc_time)
++ if (g_strcmp0 (static_era_description_locale, current_lc_time) != 0)
+ {
+ const char *era_description_str;
+ size_t era_description_str_len;
+@@ -3061,7 +3062,9 @@ date_time_lookup_era (GDateTime *datetime,
+
+ g_free (tmp);
+
+- static_era_description_locale = current_lc_time;
++ g_free (static_era_description_locale);
++ static_era_description_locale = g_strdup (current_lc_time);
++ g_ignore_leak (static_era_description_locale);
+ }
+
+ if (static_era_description == NULL)
+--
+GitLab
+
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index d1f25ef8f2..ea3ab519dd 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -232,6 +232,7 @@ SRC_URI += "\
file://0010-Do-not-hardcode-python-path-into-various-tools.patch \
file://skip-timeout.patch \
file://CVE-2026-0988.patch \
+ file://0001-glib-2.0-fix-gdatetime-ptest-failure-with-glibc-2.43.patch \
"
SRC_URI:append:class-native = " file://relocate-modules.patch \
file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \
--
2.49.0
next prev parent reply other threads:[~2026-03-12 16:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 16:10 [PATCH v4 1/8] glibc: Upgrade to 2.43 release Hemanth.KumarMD
2026-03-12 16:10 ` [PATCH v4 2/8] gettext: upgrade 0.26 -> 1.0 Hemanth.KumarMD
2026-03-12 16:10 ` [PATCH v4 3/8] gcc-runtime: avoid discarded-qualifiers build failure with glibc 2.43 Hemanth.KumarMD
2026-03-12 16:10 ` [PATCH v4 4/8] libxcrypt: " Hemanth.KumarMD
2026-03-12 16:10 ` [PATCH v4 5/8] barebox-tools: fix " Hemanth.KumarMD
2026-03-12 16:10 ` [PATCH v4 6/8] ltp: workaround openat2 " Hemanth.KumarMD
2026-03-12 16:10 ` Hemanth.KumarMD [this message]
2026-03-12 16:10 ` [PATCH v4 8/8] busybox: fix printf ptest " Hemanth.KumarMD
2026-03-12 18:52 ` [OE-core] " Randy MacLeod
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=20260312161038.2578649-7-Hemanth.KumarMD@windriver.com \
--to=hemanth.kumarmd@windriver.com \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=openembedded-core@lists.openembedded.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