Bug#762266: glib-2.0 GDateTime locale tests

Changwoo Ryu cwryu at debian.org
Mon Nov 11 02:46:47 GMT 2019


The test code needs to be corrected: setlocale() is required before
calling POSIX locale-aware functions.

--- glibtestold.c    2019-11-11 11:27:21.489271420 +0900
+++ glibtest.c    2019-11-11 11:27:09.737139535 +0900
@@ -1,3 +1,4 @@
+#include <locale.h>
 #include <glib/gstdio.h>
 #include <glib/gprintf.h>

@@ -6,6 +7,8 @@
     gchar *time;
     gchar *date;
     gchar *str;
+
+    setlocale(LC_ALL, "");

     datetime=g_date_time_new_now_local();
     time=g_date_time_format(datetime, "%X");

After this changes,

$ env LANG=th_TH ./glibtest
<span size="xx-large"weight="ultrabold">11:24:34</span>
<span size="large">(null)</span>
$

"(null)" matches the original bug report. No idea which part of glib
and/or th_TH locale make this wrong result.



More information about the pkg-gnome-maintainers mailing list