Dear Maintainer,
I've installed MATE Desktop from Debian backports repository,
the desktop worked as expected. When I selected main MATE menu
and selected "Lock Screen", screen goes black as expected.
But as I moved mouse, the screen unlock dialog appeared
with this content:
22:39:40
(null)
Nachanon Vetjasit
window on WINDOW-NB
Password: [ ] en
[Leave Message][Switch User][Cancel][Unlock]
The second line on dialog should be current system date.
But instead, it displayed as "(null)".
Screenshot of this dialog is also attached.
Regards,
Nachanon Vetjasit
This bug seems to be dependent on system's global locale settings.
In the original post, which the problem surfaced, has this
system locale settings:
LANG=th_TH
LANGUAGE=
LC_CTYPE=th_TH
LC_NUMERIC=th_TH
LC_TIME=th_TH
LC_COLLATE=th_TH
LC_MONETARY=th_TH
LC_MESSAGES=en_US
LC_PAPER=th_TH
LC_NAME=th_TH
LC_ADDRESS=th_TH
LC_TELEPHONE=th_TH
LC_MEASUREMENT=th_TH
LC_IDENTIFICATION=th_TH
LC_ALL=
But when I changed system's locale settings to all en_US:
LANG=en_US
LANGUAGE=
LC_CTYPE=en_US
LC_NUMERIC=en_US
LC_TIME=en_US
LC_COLLATE=en_US
LC_MONETARY=en_US
LC_MESSAGES=en_US
LC_PAPER=en_US
LC_NAME=en_US
LC_ADDRESS=en_US
LC_TELEPHONE=en_US
LC_MEASUREMENT=en_US
LC_IDENTIFICATION=en_US
LC_ALL=
I logged out, relogin, and tried to lock screen again. The problem
now mysteriously disappeared; second line in the dialog now shown
a correct date (but in en_US manner):
11:26:33 PM
09/20/2014
Nachanon Vetjasit
window on WINDOW-NB
Password: [ ] en
[Leave Message][Switch User][Cancel][Unlock]
Hi Nachanon, As you probably yourself have realized, this is a localization issue and possibly not even related to mate-screensaver. I need feedback on two things: 1. What does (run from the cmdline) give: $ date +%x $ date +%X Here is what I see on a German localized system: mike@<host>:~$ date +%x 25.10.2014 mike@<host>:~$ date +%X 18:07:32 2. Does the issue persist if you install a Debian jessie system that runs mate-screensaver from jessie (in your specific locale). Greets, Mike
Hello Mike,
It seems that %x and %X are printed properly using `date` command in my
locale settings. (th_TH manner):
$ date +%x
27/10/2557
$ date +%X
15:36:56
$ locale
LANG=th_TH
LANGUAGE=
LC_CTYPE=th_TH
LC_NUMERIC=th_TH
LC_TIME=th_TH
LC_COLLATE=th_TH
LC_MONETARY=th_TH
LC_MESSAGES=en_US
LC_PAPER=th_TH
LC_NAME=th_TH
LC_ADDRESS=th_TH
LC_TELEPHONE=th_TH
LC_MEASUREMENT=th_TH
LC_IDENTIFICATION=th_TH
LC_ALL=
$
However, this might be more complicated that %x and %X in
g_date_time_format() seems to works when run in isolated case.
Nevertheless, %x works in not-so-correct fashion, as it printed
mm/dd/yy (en_US) rather than dd/mm/yy (th_TH).
I tested with this snippet, which adapted from mate-sceensaver_1.8.0-5~bpo70+1
source package's `src/gs-lock-plug.c` function `date_time_update`:
#include <glib/gstdio.h>
#include <glib/gprintf.h>
int main() {
GDateTime *datetime;
gchar *time;
gchar *date;
gchar *str;
datetime=g_date_time_new_now_local();
time=g_date_time_format(datetime, "%X");
date=g_date_time_format(datetime, "%x");
str = g_strdup_printf("<span size=\"xx-large\"
weight=\"ultrabold\">%s</span>", time);
g_printf("%s\n",str);
g_free(str);
str=g_strdup_printf("<span size=\"large\">%s</span>", date);
g_printf("%s\n",str);
g_free(str);
g_free(time);
g_free(date);
g_date_time_unref(datetime);
return 0;
}
Which outputs:
$ ./glibtest
<span size="xx-large" weight="ultrabold">18:30:11</span>
<span size="large">10/27/14</span>
$
Notice that the date is printed in mm/dd/yy (en_US) fashion, even when I run
it using "LC_ALL=th_TH ./glibtest".
But the time is in the correct HH:mm:ss 24-hours (th_TH) fashion.
Regards,
Nachanon
Hi Nachanon, dear glib-2.0 maintainers, @Nachanon: thanks for your testing... @glib-2.0 maintainers: We encountered a bug in mate-screensaver that finally might boil down to the way how the GDateTime handles th_TH date strings in glib-2.0. Please see below for further explanations and possibly review the bug history. THANKS! @glib-2.0 maintainers: I'm not sure about the severity this bug should be set to. I guess, i18n and localization fixes have a high prio by the release team, thus settings this to "important". Feel free to downgrade if you are of a different opinion. This really smells like this needs to be further processed by the maintainers of Debian package glib2.0. Can you please test with LC_TIME=th_TH and LANG=th_TH.<your-common-encoding>, as well, and report back to the bug? Anyway, reassinging this bug to the glib-2.0 src:package... Mike
Control: reassign -1 glib2.0 Control: severity -1 important 2nd attempt of reassigning. Typo in previous control commands... About details see previous post. Mike
Dear Mike and glib-2.0 maintainers, I've tried few combination of LC_TIME and LANG with my glibtest snippet. Date still displayed in en_US despite all combination I've tried (LANG=th_TH.tis-620, LANG=th_TH.utf-8, LC_ALL=th_TH.tis-620, LC_ALL=th_TH.utf-8, LC_TIME=th_TH). But I've found that even with LC_ALL=en_US and LANG=en_US time is still displayed in 24-hour (th_TH) format; see the last case. Combination of LC_ALL=th_TH.tis-620 with LANG=th_TH.tis-620: $ locale LANG=th_TH.tis-620 LANGUAGE= LC_CTYPE="th_TH.tis-620" LC_NUMERIC="th_TH.tis-620" LC_TIME="th_TH.tis-620" LC_COLLATE="th_TH.tis-620" LC_MONETARY="th_TH.tis-620" LC_MESSAGES="th_TH.tis-620" LC_PAPER="th_TH.tis-620" LC_NAME="th_TH.tis-620" LC_ADDRESS="th_TH.tis-620" LC_TELEPHONE="th_TH.tis-620" LC_MEASUREMENT="th_TH.tis-620" LC_IDENTIFICATION="th_TH.tis-620" LC_ALL=th_TH.tis-620 $ date +%x 29/12/2557 $ date +%X 12:20:07 $ ./glibtest <span size="xx-large" weight="ultrabold">12:20:12</span> <span size="large">12/29/14</span> $ Combination of LC_ALL=th_TH.utf-8 with LANG=th_TH.utf-8: $ locale LANG=th_TH.utf-8 LANGUAGE= LC_CTYPE="th_TH.utf-8" LC_NUMERIC="th_TH.utf-8" LC_TIME="th_TH.utf-8" LC_COLLATE="th_TH.utf-8" LC_MONETARY="th_TH.utf-8" LC_MESSAGES="th_TH.utf-8" LC_PAPER="th_TH.utf-8" LC_NAME="th_TH.utf-8" LC_ADDRESS="th_TH.utf-8" LC_TELEPHONE="th_TH.utf-8" LC_MEASUREMENT="th_TH.utf-8" LC_IDENTIFICATION="th_TH.utf-8" LC_ALL=th_TH.utf-8 $ date +%x 29/12/2557 $ date +%X 12:27:47 $ ./glibtest <span size="xx-large" weight="ultrabold">12:27:52</span> <span size="large">12/29/14</span> $ Combination of LC_TIME=th_TH with everying else (together with LANG) in en_US: $ locale LANG=en_US LANGUAGE= LC_CTYPE=en_US LC_NUMERIC=en_US LC_TIME=th_TH LC_COLLATE=en_US LC_MONETARY=en_US LC_MESSAGES=en_US LC_PAPER=en_US LC_NAME=en_US LC_ADDRESS=en_US LC_TELEPHONE=en_US LC_MEASUREMENT=en_US LC_IDENTIFICATION=en_US LC_ALL= $ date +%x 29/12/2557 $ date +%X 11:55:02 $ ./glibtest <span size="xx-large" weight="ultrabold">11:55:07</span> <span size="large">12/29/14</span> $ Combination of LC_TIME=th_TH and LANG=th_TH with everying else in en_US: $ locale LANG=th_TH LANGUAGE= LC_CTYPE=en_US LC_NUMERIC=en_US LC_TIME=th_TH LC_COLLATE=en_US LC_MONETARY=en_US LC_MESSAGES=en_US LC_PAPER=en_US LC_NAME=en_US LC_ADDRESS=en_US LC_TELEPHONE=en_US LC_MEASUREMENT=en_US LC_IDENTIFICATION=en_US LC_ALL= $ date +%x 29/12/2557 $ date +%X 11:58:16 $ ./glibtest <span size="xx-large" weight="ultrabold">11:58:19</span> <span size="large">12/29/14</span> $ Combination of LC_ALL=en_US with LANG=th_TH.tis-620: $ locale LANG=th_TH.tis-620 LANGUAGE= LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL=en_US $ date +%x 12/29/2014 $ date +%X 11:35:18 AM $ ./glibtest <span size="xx-large" weight="ultrabold">11:35:35</span> <span size="large">12/29/14</span> $ Combination of LC_ALL=en_US with LANG=th_TH.utf-8: $ locale LANG=th_TH.utf-8 LANGUAGE= LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL=en_US $ date +%x 12/29/2014 $ date +%X 11:38:19 AM $ ./glibtest <span size="xx-large" weight="ultrabold">11:38:24</span> <span size="large">12/29/14</span> $ Combination of LC_ALL=en_US with LANG=en_US: $ locale LANG=en_US LANGUAGE= LC_CTYPE="en_US" LC_NUMERIC="en_US" LC_TIME="en_US" LC_COLLATE="en_US" LC_MONETARY="en_US" LC_MESSAGES="en_US" LC_PAPER="en_US" LC_NAME="en_US" LC_ADDRESS="en_US" LC_TELEPHONE="en_US" LC_MEASUREMENT="en_US" LC_IDENTIFICATION="en_US" LC_ALL=en_US $ date +%x 12/29/2014 $ date +%X 01:03:42 PM $ ./glibtest <span size="xx-large" weight="ultrabold">13:03:48</span> <span size="large">12/29/14</span> $ This last case is a quite interesting, since I specified all en_US locale, but time is still displayed as 24-hour clock (th_TH) rather than 12-hour clock with AM/PM (en_US). Note: "th_TH" is an alias of "th_TH.tis-620". Regards, Nachanon P.S. These are tested by overriding locale using environment variable. My default system-wide locale (specified in /etc/default/locale) is: LANG=th_TH LC_CTYPE="th_TH" LC_NUMERIC="th_TH" LC_TIME="th_TH" LC_COLLATE="th_TH" LC_MONETARY="th_TH" LC_MESSAGES="en_US" LC_PAPER="th_TH" LC_NAME="th_TH" LC_ADDRESS="th_TH" LC_TELEPHONE="th_TH" LC_MEASUREMENT="th_TH" LC_IDENTIFICATION="th_TH" LC_ALL=
--- 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.