New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game freezes on draw menu if "path_user" variable contains non-latin chars #2796

Closed
dngulin opened this Issue Jun 16, 2015 · 17 comments

Comments

Projects
None yet
2 participants
@dngulin
Contributor

dngulin commented Jun 16, 2015

I was build minetest with -DRUN-IN_PLACE=TRUE option and got game freeze at opening menu (by ESC key) when game files is located in directory /home/user/игры/minetest (path contains cyrillic chars). When i move game files to /home/user/games/minetest, menu was opened correctly.

Logfile not contains any error messages.

Debug info at freeze:

Program received signal SIGINT, Interrupt.
0x00007ffff2f410b6 in iconv () from /usr/lib/libc.so.6
(gdb) where
#0  0x00007ffff2f410b6 in iconv () from /usr/lib/libc.so.6
#1  0x00000000005e9338 in utf8_to_wide(std::string const&) ()
#2  0x000000000073dcfe in GUIFormSpecMenu::parseTextArea(GUIFormSpecMenu::parserData*, std::vector<std::string, std::allocator<std::string> >&, std::string) ()
#3  0x000000000073e4f1 in GUIFormSpecMenu::parseField(GUIFormSpecMenu::parserData*, std::string, std::string) ()
#4  0x0000000000746ea6 in GUIFormSpecMenu::parseElement(GUIFormSpecMenu::parserData*, std::string) ()
#5  0x0000000000748a9f in GUIFormSpecMenu::regenerateGui(irr::core::vector2d<unsigned int>) ()
#6  0x000000000074a444 in GUIFormSpecMenu::drawMenu() ()
#7  0x000000000072fcc3 in GUIModalMenu::draw() ()
#8  0x00007ffff7819d82 in irr::gui::CGUIStaticText::draw() () from /usr/lib/libIrrlicht.so.1.8
#9  0x0000000000721a9a in irr::gui::IGUIElement::draw() ()
#10 0x00007ffff77dbc11 in irr::gui::CGUIEnvironment::drawAll() () from /usr/lib/libIrrlicht.so.1.8
#11 0x00000000006cbfe2 in draw_scene(irr::video::IVideoDriver*, irr::scene::ISceneManager*, Camera&, Client&, LocalPlayer*, Hud&, irr::gui::IGUIEnvironment*, std::vector<irr::core::aabbox3d<float>, std::allocator<irr::core::aabbox3d<float> > >, irr::core::vector2d<unsigned int> const&, irr::video::SColor, bool) ()
#12 0x000000000070b5c4 in Game::updateFrame(std::vector<irr::core::aabbox3d<float>, std::allocator<irr::core::aabbox3d<float> > >&, ProfilerGraph*, RunStats*, GameRunData*, float, VolatileRunFlags const&, CameraOrientation const&)
    ()
#13 0x000000000070e6c5 in Game::run() ()
#14 0x000000000070f23c in the_game(bool*, bool, InputHandler*, irr::IrrlichtDevice*, std::string const&, std::string const&, std::string const&, std::string const&, unsigned short, std::string&, ChatBackend&, SubgameSpec const&, bool) ()
#15 0x00000000004a61f6 in ClientLauncher::run(GameParams&, Settings const&) ()
#16 0x000000000049e206 in main ()

PS. Sorry for my bad English.

@est31 est31 added the Bug label Jun 16, 2015

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 16, 2015

Contributor

Can you try with commit aa13baa?

Contributor

est31 commented Jun 16, 2015

Can you try with commit aa13baa?

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 16, 2015

Contributor

Also it would be great to have debug info with line numbers. For this, pass -DCMAKE_BUILD_TYPE=Debug to cmake.

Contributor

est31 commented Jun 16, 2015

Also it would be great to have debug info with line numbers. For this, pass -DCMAKE_BUILD_TYPE=Debug to cmake.

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

It works for me. Can you provide additional info about your computer? Which OS? which filesystem (NTFS, ext4, etc)?

Contributor

est31 commented Jun 17, 2015

It works for me. Can you provide additional info about your computer? Which OS? which filesystem (NTFS, ext4, etc)?

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

More verbose debug info about freeze (latest git version, game at /home/user/тест/minetest):

#0  0x00007ffff2f4106f in iconv () from /usr/lib/libc.so.6
#1  0x0000000000817b69 in convert (to=0xb39d56 "WCHAR_T", from=0xb39d50 "UTF-8", outbuf=0x4ee9610 "M", outbuf_size=96, 
    inbuf=0x59866e0 "Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/minetest/bin/..\n", 
    inbuf_size=21) at /home/user/тест/minetest/src/util/string.cpp:60
#2  0x0000000000817c3d in utf8_to_wide (
    input="Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/minetest/bin/..\n")
    at /home/user/тест/minetest/src/util/string.cpp:77
#3  0x00000000009332f3 in GUIFormSpecMenu::parseTextArea (this=0x5983ad0, data=0x7fffffffca90, parts=std::vector of length 5, capacity 8 = {...}, type="textarea") at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1098
#4  0x0000000000933a24 in GUIFormSpecMenu::parseField (this=0x5983ad0, data=0x7fffffffca90, 
    element="0.4,0.25;3.5,6;;Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/"..., 
    type="textarea") at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1172
#5  0x0000000000938103 in GUIFormSpecMenu::parseElement (this=0x5983ad0, data=0x7fffffffca90, 
    element="textarea[0.4,0.25;3.5,6;;Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user", <incomplete sequence \321>...) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1759
#6  0x0000000000939cbd in GUIFormSpecMenu::regenerateGui (this=0x5983ad0, screensize=...) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:2040
#7  0x000000000093b31c in GUIFormSpecMenu::drawMenu (this=0x5983ad0) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:2296
#8  0x0000000000929ca5 in GUIModalMenu::draw (this=0x5983ad0) at /home/user/тест/minetest/src/modalMenu.h:91
#9  0x00007ffff7819d82 in irr::gui::CGUIStaticText::draw() () from /usr/lib/libIrrlicht.so.1.8
#10 0x0000000000922eea in irr::gui::IGUIElement::draw (this=0x1c66178) at /usr/include/irrlicht/IGUIElement.h:318
#11 0x00007ffff77dbc11 in irr::gui::CGUIEnvironment::drawAll() () from /usr/lib/libIrrlicht.so.1.8
#12 0x00000000008cbe64 in draw_scene (driver=0x1c47e60, smgr=0x1c7b190, camera=..., client=..., player=0x20423b0, hud=..., guienv=0x1c66170, hilightboxes=std::vector of length 1, capacity 1 = {...}, screensize=..., skycolor=..., 
    show_hud=true) at /home/user/тест/minetest/src/drawscene.cpp:489
#13 0x000000000090cc87 in Game::updateFrame (this=0x7fffffffd8a0, highlight_boxes=std::vector of length 1, capacity 1 = {...}, graph=0x7fffffffd7b0, stats=0x7fffffffd760, runData=0x7fffffffd6d0, dtime=0, flags=..., cam=...)
    at /home/user/тест/minetest/src/game.cpp:3956
#14 0x00000000009014e2 in Game::run (this=0x7fffffffd8a0) at /home/user/тест/minetest/src/game.cpp:1821
#15 0x000000000090e510 in the_game (kill=0xf39f90 <porting::g_killed>, random_input=false, input=0x1c61210, device=0x18dd720, map_dir="/home/user/тест/minetest/bin/../worlds/мир", playername="singleplayer", password="", 
    address="", port=57065, error_message="", chat_backend=..., gamespec=..., simple_singleplayer_mode=true) at /home/user/тест/minetest/src/game.cpp:4284
#16 0x00000000006fd863 in ClientLauncher::run (this=0x7fffffffe060, game_params=..., cmd_args=...) at /home/user/тест/minetest/src/client/clientlauncher.cpp:250
#17 0x00000000009a0b34 in main (argc=1, argv=0x7fffffffe4b8) at /home/user/тест/minetest/src/main.cpp:237

Game builded with HEAD at aa13baa has no freezes, but also has not UTF-8 support in interface. When i send to chat: "привет" (hello), i see in log:

2015-06-17 18:46:38: ACTION[ServerThread]: CHAT: <singleplayer> 뿐胑룐닐뗐苑

Also information string at left part of menu generated incorrectly ("invalid multibyte string"):
invalid multibyte string

Contributor

dngulin commented Jun 17, 2015

More verbose debug info about freeze (latest git version, game at /home/user/тест/minetest):

#0  0x00007ffff2f4106f in iconv () from /usr/lib/libc.so.6
#1  0x0000000000817b69 in convert (to=0xb39d56 "WCHAR_T", from=0xb39d50 "UTF-8", outbuf=0x4ee9610 "M", outbuf_size=96, 
    inbuf=0x59866e0 "Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/minetest/bin/..\n", 
    inbuf_size=21) at /home/user/тест/minetest/src/util/string.cpp:60
#2  0x0000000000817c3d in utf8_to_wide (
    input="Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/minetest/bin/..\n")
    at /home/user/тест/minetest/src/util/string.cpp:77
#3  0x00000000009332f3 in GUIFormSpecMenu::parseTextArea (this=0x5983ad0, data=0x7fffffffca90, parts=std::vector of length 5, capacity 8 = {...}, type="textarea") at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1098
#4  0x0000000000933a24 in GUIFormSpecMenu::parseField (this=0x5983ad0, data=0x7fffffffca90, 
    element="0.4,0.25;3.5,6;;Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user/тес\321\n\202/"..., 
    type="textarea") at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1172
#5  0x0000000000938103 in GUIFormSpecMenu::parseElement (this=0x5983ad0, data=0x7fffffffca90, 
    element="textarea[0.4,0.25;3.5,6;;Minetest\nVER=0.4.12-dev-a1a2ac7 BUILD_TYPE=Debug RUN_IN_PLACE=1 USE_GETTEXT=0 USE_SOUND=1 USE_CURL=1 USE_FREETYPE=1 USE_LUAJIT=1 STATIC_SHAREDIR=\".\"\npath_user = /home/user", <incomplete sequence \321>...) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:1759
#6  0x0000000000939cbd in GUIFormSpecMenu::regenerateGui (this=0x5983ad0, screensize=...) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:2040
#7  0x000000000093b31c in GUIFormSpecMenu::drawMenu (this=0x5983ad0) at /home/user/тест/minetest/src/guiFormSpecMenu.cpp:2296
#8  0x0000000000929ca5 in GUIModalMenu::draw (this=0x5983ad0) at /home/user/тест/minetest/src/modalMenu.h:91
#9  0x00007ffff7819d82 in irr::gui::CGUIStaticText::draw() () from /usr/lib/libIrrlicht.so.1.8
#10 0x0000000000922eea in irr::gui::IGUIElement::draw (this=0x1c66178) at /usr/include/irrlicht/IGUIElement.h:318
#11 0x00007ffff77dbc11 in irr::gui::CGUIEnvironment::drawAll() () from /usr/lib/libIrrlicht.so.1.8
#12 0x00000000008cbe64 in draw_scene (driver=0x1c47e60, smgr=0x1c7b190, camera=..., client=..., player=0x20423b0, hud=..., guienv=0x1c66170, hilightboxes=std::vector of length 1, capacity 1 = {...}, screensize=..., skycolor=..., 
    show_hud=true) at /home/user/тест/minetest/src/drawscene.cpp:489
#13 0x000000000090cc87 in Game::updateFrame (this=0x7fffffffd8a0, highlight_boxes=std::vector of length 1, capacity 1 = {...}, graph=0x7fffffffd7b0, stats=0x7fffffffd760, runData=0x7fffffffd6d0, dtime=0, flags=..., cam=...)
    at /home/user/тест/minetest/src/game.cpp:3956
#14 0x00000000009014e2 in Game::run (this=0x7fffffffd8a0) at /home/user/тест/minetest/src/game.cpp:1821
#15 0x000000000090e510 in the_game (kill=0xf39f90 <porting::g_killed>, random_input=false, input=0x1c61210, device=0x18dd720, map_dir="/home/user/тест/minetest/bin/../worlds/мир", playername="singleplayer", password="", 
    address="", port=57065, error_message="", chat_backend=..., gamespec=..., simple_singleplayer_mode=true) at /home/user/тест/minetest/src/game.cpp:4284
#16 0x00000000006fd863 in ClientLauncher::run (this=0x7fffffffe060, game_params=..., cmd_args=...) at /home/user/тест/minetest/src/client/clientlauncher.cpp:250
#17 0x00000000009a0b34 in main (argc=1, argv=0x7fffffffe4b8) at /home/user/тест/minetest/src/main.cpp:237

Game builded with HEAD at aa13baa has no freezes, but also has not UTF-8 support in interface. When i send to chat: "привет" (hello), i see in log:

2015-06-17 18:46:38: ACTION[ServerThread]: CHAT: <singleplayer> 뿐胑룐닐뗐苑

Also information string at left part of menu generated incorrectly ("invalid multibyte string"):
invalid multibyte string

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

I have a theory now of what goes wrong: the call to iconv doesn't reduce the size of inbuf, but that means iconv isn't converting. Don't know why.

Contributor

est31 commented Jun 17, 2015

I have a theory now of what goes wrong: the call to iconv doesn't reduce the size of inbuf, but that means iconv isn't converting. Don't know why.

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

Can you provide additional info about your computer? Which OS? which filesystem (NTFS, ext4, etc)?

$ uname -a
Linux dhome 4.0.5-1-ARCH #1 SMP PREEMPT Sat Jun 6 18:37:49 CEST 2015 x86_64 GNU/Linux
$ lsb_release -a
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a
$ cat /etc/mtab | grep sda
/dev/sda6 / ext4 rw,relatime,data=ordered 0 0
/dev/sda7 /home ext4 rw,relatime,data=ordered 0 0
Contributor

dngulin commented Jun 17, 2015

Can you provide additional info about your computer? Which OS? which filesystem (NTFS, ext4, etc)?

$ uname -a
Linux dhome 4.0.5-1-ARCH #1 SMP PREEMPT Sat Jun 6 18:37:49 CEST 2015 x86_64 GNU/Linux
$ lsb_release -a
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a
$ cat /etc/mtab | grep sda
/dev/sda6 / ext4 rw,relatime,data=ordered 0 0
/dev/sda7 /home ext4 rw,relatime,data=ordered 0 0
@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

can you provide the output of echo $LANG?

Contributor

est31 commented Jun 17, 2015

can you provide the output of echo $LANG?

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

can you provide the output of echo $LANG?

$ echo "$LANG"
ru_RU.utf8
Contributor

dngulin commented Jun 17, 2015

can you provide the output of echo $LANG?

$ echo "$LANG"
ru_RU.utf8
@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

If you type "привет" at master into chat, does that work at least?

Contributor

est31 commented Jun 17, 2015

If you type "привет" at master into chat, does that work at least?

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

Can you compile 6dcf549, run minetest with the --info flag, open the ESC menu, and paste any log messages with "Couldn't convert" here?

Contributor

est31 commented Jun 17, 2015

Can you compile 6dcf549, run minetest with the --info flag, open the ESC menu, and paste any log messages with "Couldn't convert" here?

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

If you type "привет" at master into chat, does that work at least?

Yes, at version a1a2ac7 all looks like works correctly, except for the game menu.

2015-06-17 20:12:14: ACTION[ServerThread]: CHAT: <singleplayer> привет
Contributor

dngulin commented Jun 17, 2015

If you type "привет" at master into chat, does that work at least?

Yes, at version a1a2ac7 all looks like works correctly, except for the game menu.

2015-06-17 20:12:14: ACTION[ServerThread]: CHAT: <singleplayer> привет
@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

Can you compile 6dcf549, run minetest with the --info flag, and paste any log messages with "Couldn't convert" here?

Version 6dcf549 works more correct: i can open menu without freeze. But left part of menu displayed as "invalid UTF-8 string".

Logfile message at menu open:

2015-06-17 20:17:16: INFO[main]: Couldn't convert UTF-8 string 0x4d696e65746573740a5645523d302e342e31322d6465762d36646366353439204255494c445f545950453d44656275672052554e5f494e5f504c4143453d31205553455f474554544558543d30205553455f534f554e443d31205553455f4355524c3d31205553455f46524545545950453d31205553455f4c55414a49543d31205354415449435f53484152454449523d222e220a706174685f75736572203d202f686f6d652f726170746f722fd182d0b5d181d10a822f6d696e65746573742f62696e2f2e2e0a into wstring
Contributor

dngulin commented Jun 17, 2015

Can you compile 6dcf549, run minetest with the --info flag, and paste any log messages with "Couldn't convert" here?

Version 6dcf549 works more correct: i can open menu without freeze. But left part of menu displayed as "invalid UTF-8 string".

Logfile message at menu open:

2015-06-17 20:17:16: INFO[main]: Couldn't convert UTF-8 string 0x4d696e65746573740a5645523d302e342e31322d6465762d36646366353439204255494c445f545950453d44656275672052554e5f494e5f504c4143453d31205553455f474554544558543d30205553455f534f554e443d31205553455f4355524c3d31205553455f46524545545950453d31205553455f4c55414a49543d31205354415449435f53484152454449523d222e220a706174685f75736572203d202f686f6d652f726170746f722fd182d0b5d181d10a822f6d696e65746573742f62696e2f2e2e0a into wstring
@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

Very interesting. You can see on this site, that the character sequence d182d0b5d181d10a822f6d696e is invalid. The 0a inserted is wrong, its inside the multi-byte sequence d10a82 (which in theory should map to 'т'). This is a line-wrap error!

Contributor

est31 commented Jun 17, 2015

Very interesting. You can see on this site, that the character sequence d182d0b5d181d10a822f6d696e is invalid. The 0a inserted is wrong, its inside the multi-byte sequence d10a82 (which in theory should map to 'т'). This is a line-wrap error!

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

Very interesting. You can see on this site, that the character sequence d182d0b5d181d10a822f6d696e is invalid. The 0a inserted is wrong. This is a line-wrap error!

Looks like wrap position clculated in bytes instead of chars.

Contributor

dngulin commented Jun 17, 2015

Very interesting. You can see on this site, that the character sequence d182d0b5d181d10a822f6d696e is invalid. The 0a inserted is wrong. This is a line-wrap error!

Looks like wrap position clculated in bytes instead of chars.

@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 17, 2015

Contributor

I think that this function is incorrect for UTF-8:

void intlGUIEditBox::breakText()

Contributor

dngulin commented Jun 17, 2015

I think that this function is incorrect for UTF-8:

void intlGUIEditBox::breakText()

@est31

This comment has been minimized.

Show comment
Hide comment
@est31

est31 Jun 17, 2015

Contributor

Your bug is triggered by this function

Contributor

est31 commented Jun 17, 2015

Your bug is triggered by this function

@est31 est31 closed this in 45a9bb3 Jun 17, 2015

est31 added a commit that referenced this issue Jun 17, 2015

Make wrap_rows not wrap inside utf-8 multibyte sequences
Also count multibyte sequences as "one" character.
Adds unittest for the bug reporter's case.
Fixes #2796.
@dngulin

This comment has been minimized.

Show comment
Hide comment
@dngulin

dngulin Jun 18, 2015

Contributor

Thank you for fast fixing the bug.

Contributor

dngulin commented Jun 18, 2015

Thank you for fast fixing the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment