https://bugs.winehq.org/show_bug.cgi?id=51407
Bug ID: 51407 Summary: kernel32:time's test_GetCalendarInfo() fails in Hindi Product: Wine Version: 6.10 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
Created attachment 70263 --> https://bugs.winehq.org/attachment.cgi?id=70263 Broken fix and traces
Three GetCalendarInfo() checks fail in Hindi:
https://test.winehq.org/data/patterns.html#kernel32:time
time.c:728: Test failed: GetCalendarInfoA failed err 87 time.c:731: Test failed: GetCalendarInfoA failed err 87 time.c:738: Test failed: got 0, expected 7
The immediate cause for the failure is that Hindi is one of the few languages for which NLS_IsUnicodeOnlyLcid() returns true. In turn this causes the ANSI GetCalendarInfoA() to return ERROR_INVALID_PARAMETER. The last failure just reflects the fact that the two calls to GetCalendarInfoA() should not have failed.
Only Hindi fails and only in Wine. But before declaring this a Wine bug we need to look at Windows.
* For some reason probably related to SetWinLocale [1] the system locale of w10pro64_hi is still English.
* This causes both the ANSI and Unicode GetCalendarInfo() to return English names (Monday).
* Manually setting the system locale to Hindi is possible on Windows 10 2004. What's interesting is the disabled and checked-by-default checkbox in that dialog: [X] Beta: Use Unicode UTF-8 for worldwide language support
* And indeed doing that and running the test again results in GetCalendarInfoA() returning UTF-8 strings on Windows!
time.c:730: ret=19 sdayname1="\xe0\xa4\xb8\xe0\xa5\x8b\xe0\xa4\xae\xe0\xa4\xb5\xe0\xa4\xbe\xe0\xa4\xb0" सोमवार time.c:735: ret2=19 sdayname1="\xe0\xa4\xb8\xe0\xa5\x8b\xe0\xa4\xae\xe0\xa4\xb5\xe0\xa4\xbe\xe0\xa4\xb0" सोमवार time.c:742: ret2=19 sdayname1=L"\0938\094b\092e\0935\093e\0930"
* The beta moniker strongly suggests that this is a new option. Indeed selecting Hindi as the system locale was not possible in Windows 8.1 for instance.
* This is probably also why SetWinLocale has trouble setting the system locale to Hindi.
So the Windows behavior can be summarized as such: * Return localized values for non-Unicode-only locales. * In older Windows versions setting the system locale to a Unicode-only locale is impossible. * In newer Windows versions setting the system locale to a Unicode-only locale is possible and then it uses UTF-8.
Commenting out the Hindi line in NLS_IsUnicodeOnlyLcid() fixes the failures in Wine (see attached patch). But this fix is wrong because it causes GetCalendarInfoA() to return question marks instead of intelligible strings. (it also impacts many APIs but that's probably ok based on the Windows behavior)
So Wine should do one of the following:
1. Stick to a 'safe' system locale when $LANG is set to a Unicode-only locale. Typically this would be English.
2. Or use UTF-8 when the system locale is a Unicode-only locale.
Option 2 would actually make a lot of sense on Unix systems but it is also more likely to break Windows applications. So option 1 may be the safer (and simpler?) option (for now).
[1] https://source.winehq.org/git/tools.git/blob/HEAD:/testbot/bin/SetWinLocale#...
https://bugs.winehq.org/show_bug.cgi?id=51407
--- Comment #1 from François Gouget fgouget@codeweavers.com --- Created attachment 70264 --> https://bugs.winehq.org/attachment.cgi?id=70264 Windows 10 2009 System locale dialog
Note: The previous comment said setting the system locale to Hindi is possible on Windows 10 2004. But in fact the tests were done on Windows 10 2009. The state of Hindi support on Windows 10 2004 is unknown (not that this changes anything).
https://bugs.winehq.org/show_bug.cgi?id=51407
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source, testcase
https://bugs.winehq.org/show_bug.cgi?id=51407
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|kernel32:time's |kernel32:time, msvcrt:time |test_GetCalendarInfo() |and shlwapi:ordinal fail in |fails in Hindi |Wine because Hindi is | |Unicode-only
--- Comment #2 from François Gouget fgouget@codeweavers.com --- This issue also impacts:
* test_strdate() and test_strtime() in msvcrt:time
time.c:378: Test failed: Wrong length: returned 37, should be 8 time.c:380: Test failed: Wrong format: count = 0, should be 3 time.c:413: Test failed: Wrong length: returned 0, should be 8 time.c:415: Test failed: Wrong format: count = -1, should be 3
* test_SHFormatDateTimeA() in shlwapi:ordinal
ordinal.c:1724: Test failed: got 0 -> not shown: GetLastError() is ERROR_INVALID_PARAMETER ordinal.c:1725: Test failed: expected ( ), got (19:20) ordinal.c:1731: Test failed: got 0 ordinal.c:1732: Test failed: expected ( ), got (19:20:01) ordinal.c:1739: Test failed: got 0 ordinal.c:1740: Test failed: expected ( ), got (19:20:01) ordinal.c:1746: Test failed: got 0 ordinal.c:1747: Test failed: expected ( ), got (02-07-2021) ordinal.c:1753: Test failed: got 0 ordinal.c:1754: Test failed: expected ( ), got (02 ????? 2021) ordinal.c:1761: Test failed: got 0 ordinal.c:1762: Test failed: expected ( ), got (02 ????? 2021) ordinal.c:1769: Test failed: got 0 ordinal.c:1770: Test failed: expected (^), got (:20) for time part ordinal.c:1774: Test failed: got 0 ordinal.c:1776: Test failed: expected ( ) got (0) for date part ordinal.c:1783: Test failed: got 0 ordinal.c:1784: Test failed: expected (^), got (:01) for time part ordinal.c:1788: Test failed: got 0 ordinal.c:1790: Test failed: expected ( ) got (0) for date part ordinal.c:1797: Test failed: got 0 ordinal.c:1800: Test failed: got 0 ordinal.c:1802: Test failed: expected ( ^), got (02-07-2021 19:20) ordinal.c:1808: Test failed: got 0 ordinal.c:1811: Test failed: got 0 ordinal.c:1813: Test failed: expected ( ^ ^), got (02-07-2021 19:20:01)
The attached broken NLS_IsUnicodeOnlyLcid() patch fixes these failures too.
https://bugs.winehq.org/show_bug.cgi?id=51407
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=51407
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #3 from Piotr Caban piotr.caban@gmail.com --- The msvcrt tests failures are fixed by 2f2891e5d59dcec5810ca6809eb857bcfc29aae4 and 0e9431b809fd12d1055baa99bee07a02af2d7a4d commits.
https://bugs.winehq.org/show_bug.cgi?id=51407
François Gouget fgouget@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED Fixed by SHA1| |2f2891e5d59dcec5810ca6809eb | |857bcfc29aae4
--- Comment #4 from François Gouget fgouget@codeweavers.com --- None of these tests fails anymore so I am marking this bug as resolved.
https://bugs.winehq.org/show_bug.cgi?id=51407
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 7.8.