http://bugs.winehq.org/show_bug.cgi?id=35320
Bug ID: 35320 Summary: wine crash in MSVCRT__mbstowcs_l regarding locale, & other minor locale related problems Product: Wine Version: 1.7.10 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: htl10@users.sourceforge.net Classification: Unclassified
Created attachment 47106 --> http://bugs.winehq.org/attachment.cgi?id=47106 The file needed to cause the crash.
from r project (http://www.r-project.org/) http://cran.ma.imperial.ac.uk/bin/windows/base/R-2.15.3-win.exe
After installing, running:
./wine ~/.wine/drive_c/Program\ Files/R/R-2.15.3/bin/R.exe
Then, at the R console prompt, type (having put the attached file at /tmp/1.R):
Sys.setlocale("LC_CTYPE", "Chinese") source('z:/tmp/1.R', encoding='UTF8')
wine immediately crashes with: -------------------------------------- wine: Unhandled page fault on read access to 0x00000000 at address 0x7eda29af (thread 0030), starting debugger... ...
Backtrace: =>0 0x7eda29af MSVCRT__mbstowcs_l+0x5f(wcstr=<couldn't compute location>, mbstr=<couldn't compute location>, count=<couldn't compute location>, locale=<couldn't compute location>) [/home/Nobak-Hin-Tak/tmp-git/wine/dlls/msvcrt/mbcs.c:2140] in msvcrt (0x0440a168) 1 0x7eda2b06 MSVCRT_mbstowcs+0x35(wcstr="as a &Metafile CTRL+W", mbstr=0x0(nil), count=0x64) [/home/Nobak-Hin-Tak/tmp-git/wine/dlls/msvcrt/mbcs.c:2161] in msvcrt (0x0440a198) 2 0x6355b525 in rgraphapp (+0x1b524) (0x00030046) 0x7eda29af MSVCRT__mbstowcs_l+0x5f [/home/Nobak-Hin-Tak/tmp-git/wine/dlls/msvcrt/mbcs.c:2140] in msvcrt: movzbl 0x0(%eax),%eax 2140 if(mbstr[size] == '\0') ... ----------------------------------------
I assume this info in the backtrace should be enough to address the crash.
FYI, the slightly unusual procedure is because under R under Vista in an English locale doesn't like to plot graphs with non-latin annotations/texts. The above procedure when used under Vista on British English windows would result in R displaying an almost empty plot with a chinese title. Native R on linux does not need the setlocale part to plot utf8-based texts.
Also R on Vista accepts 'Sys.setlocale("LC_CTYPE", "Chinese_China.950")'. I only realized that trying to set traditional chinese [950] in a simplified chinese region [china] is wrong when it is rejected on linux; but R on Vista accepts this.
------------ Warning message: In Sys.setlocale("LC_CTYPE", "Chinese_China.950") : OS reports request to set locale to "Chinese_China.950" cannot be honored ------------
When R is running on Vista, it reports the locale as "English_United Kingdom.1252".
But under Linux (in en_GB.utf8 locale), R warns of
----------- During startup - Warning messages: 1: Setting LC_TIME=en_GB.utf8 failed 2: Setting LC_MONETARY=en_GB.utf8 failed -----------
So three locale related issue:
- a crash in msvcrt - R under Vista accepts "Chinese_China.950" but R under wine does not. - there are locale-related warning messages from R on start up when running under wine.
http://bugs.winehq.org/show_bug.cgi?id=35320
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #1 from Piotr Caban piotr.caban@gmail.com --- 1) (In reply to comment #0)
- there are locale-related warning messages from R on start up when running
under wine.
This is not a wine bug. Similar warnings will be displayed on windows when you set LC_ALL=en_GB.utf8
http://bugs.winehq.org/show_bug.cgi?id=35320
--- Comment #2 from Hin-Tak Leung htl10@users.sourceforge.net --- (In reply to comment #1)
- (In reply to comment #0)
- there are locale-related warning messages from R on start up when running
under wine.
This is not a wine bug. Similar warnings will be displayed on windows when you set LC_ALL=en_GB.utf8
You are right that similar warnings is displayed on windows when you try to set LC_ALL=en_GB.utf8 *manually*. However, the warnings happens *without user action* - i.e. the application itself is trying to detect the locale of the host, when it starts. So wine is not emulating that part of windows like windows does.
ALso this is rather a side-issue, compared to the main one, and the 2nd one: a course of action which works without incidents on Vista, crashes wine; also setting "Chinese_China.950" *manually* on English Vista works, but fails on wine.
I know running R on English locale Vista is probably quite different from running windows R on wine on en_GB.UTF8 linux. But setlocale(, NULL) from within a windows application probably should returns something that looks like it is from windows?
FWIW, R is GPL and the recommended way of building it for windows is mingw so it probably doesn't not use anything windows-specific. I just had a look inside - while I can't work out how/why it tries to setlocale on start up, it seems that the manual setlocale/getlocale code is nothing more than wrappers around the ANSI setlocale calls.
http://bugs.winehq.org/show_bug.cgi?id=35320
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|wine crash in |setlocale(Chinese_China.950 |MSVCRT__mbstowcs_l |) returns NULL |regarding locale, & other | |minor locale related | |problems |
--- Comment #3 from Piotr Caban piotr.caban@gmail.com --- 1) The crash is fixed in current wine. 2) Not yet addressed 3) Will not be fixed. You can leave with warnings, run wine with different LC_ALL setting or reconfigure wine to overwrite this variable. LC_ALL is not a Windows environment variable so wine should not try to change/hide it in any way.
(changing bug summary)
https://bugs.winehq.org/show_bug.cgi?id=35320
--- Comment #4 from Austin English austinenglish@gmail.com --- This is your friendly reminder that there has been no bug activity for over a year. Is this still an issue in current (1.7.37 or newer) wine? If so, please attach the terminal output in 1.7.37 (see http://wiki.winehq.org/FAQ#get_log).
https://bugs.winehq.org/show_bug.cgi?id=35320
--- Comment #5 from Piotr Caban piotr.caban@gmail.com --- It's still not fixed.
https://bugs.winehq.org/show_bug.cgi?id=35320
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gijsvrm@gmail.com
--- Comment #6 from Gijs Vermeulen gijsvrm@gmail.com --- I can not reproduce this with wine-2.18 following the exact instructions from comment #1. My guess is that this was fixed by: https://source.winehq.org/git/wine.git/commitdiff/f091d9edf652eb2b45d8042c59...
https://bugs.winehq.org/show_bug.cgi?id=35320
--- Comment #7 from Gijs Vermeulen gijsvrm@gmail.com --- (In reply to Gijs Vermeulen from comment #6)
I can not reproduce this with wine-2.18 following the exact instructions from comment #1. My guess is that this was fixed by: https://source.winehq.org/git/wine.git/commitdiff/ f091d9edf652eb2b45d8042c598addd7d0ef4d2c
It seems I misread the bug when I posted this. The crash is indeed gone, but Sys.setlocale("LC_CTYPE", "Chinese_China.950") still gives the aforementioned warning and prevents the attached 1.R file from opening. Wine 2.22.
https://bugs.winehq.org/show_bug.cgi?id=35320
--- Comment #8 from Gijs Vermeulen gijsvrm@gmail.com --- This time I'm sure this was fixed by (I tested everything correctly this time): https://source.winehq.org/git/wine.git/commit/8905bd92aa61ed5493844cbe65db4e...
Sorry about the earlier noise.
https://bugs.winehq.org/show_bug.cgi?id=35320
tokktokk fdsfgs@krutt.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fdsfgs@krutt.org
https://bugs.winehq.org/show_bug.cgi?id=35320
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |8905bd92aa61ed5493844cbe65d | |b4eedca6839c7 Status|UNCONFIRMED |RESOLVED
--- Comment #9 from Gijs Vermeulen gijsvrm@gmail.com --- I'm going to mark this FIXED, since I was able to confirm it was fixed. If anyone is still able to reproduce the issue, feel free to reopen.
https://bugs.winehq.org/show_bug.cgi?id=35320
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #10 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 3.20.
https://bugs.winehq.org/show_bug.cgi?id=35320
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |3.0.x
https://bugs.winehq.org/show_bug.cgi?id=35320
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|3.0.x |---
--- Comment #11 from Michael Stefaniuc mstefani@winehq.org --- Removing the 3.0.x milestone from bug fixes included in 3.0.5.