Bug 359255 - OSX Japanese env: Krita3.0 prealpha assert&crash on startup
Summary: OSX Japanese env: Krita3.0 prealpha assert&crash on startup
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 3.0 Alpha
Platform: macOS (DMG) macOS
: NOR grave
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-11 04:18 UTC by guruguru.sp
Modified: 2016-06-04 09:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
assert dialog (44.24 KB, image/png)
2016-02-11 04:19 UTC, guruguru.sp
Details
log file (2.40 KB, text/plain)
2016-06-02 02:07 UTC, guruguru.sp
Details
new log (46.03 KB, text/plain)
2016-06-02 10:16 UTC, guruguru.sp
Details
newest log (33.26 KB, text/plain)
2016-06-02 13:45 UTC, guruguru.sp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description guruguru.sp 2016-02-11 04:18:56 UTC
When using Japanese UI in OSX, Krita 3.0 prealpha shows assert dialog then crash.



Reproducible: Always




This happened on my MacBook Air, El Capitan.
Krita seems to be having some resource path issue on OSX when using OSX in Japanese mode. In past, there were issues like  "Krita language setting does not take effect" and "icons are missing"

To test this issue, I think one can use System Preferences > Language & Region Preference in OSX. Add Japanese and put it on the top of your language list.
Comment 1 guruguru.sp 2016-02-11 04:19:31 UTC
Created attachment 97142 [details]
assert dialog
Comment 2 Halla Rempt 2016-02-11 08:55:34 UTC
Hm, I haven't been able to reproduce (though I noticed that the language selection dialog has gone). That assert means that krita cannot find the xmlgui file called krita.rc, which should be right there in the bundle. What is the full path to the bundle when you tested it?
Comment 3 Halla Rempt 2016-02-11 08:56:54 UTC
Oh, the missing language dialog is simply because there aren't any translations packaged yet.
Comment 4 guruguru.sp 2016-02-11 09:55:22 UTC
To be clarify, I'm aware Krita3.0 is not having language selection because it does not have the localized resource. I wanted to point out previous Krita2.9 did have resource loading issues.(Krita2.9 does include language resource, show language selection, but selected language does not take effect when OSX is Japanese mode)

To reproduce this, OSX's system language needs to be switched. I was using OSX in English to workaround Krita2.9 OSX bug, that's why it took me a while to discover this crash. I saw a Japanese twitter post that says pre-alphas instantly crash that led me to test it.

I put Krita.app to Application folder...and I see krita.rc is included in the package(share/krita).
Comment 5 Halla Rempt 2016-02-11 11:40:02 UTC
Yes, I tried to enable Japanese, but I didn't get the crash yet. I'll check some more. Coffee first, through :-)
Comment 6 guruguru.sp 2016-02-12 15:13:30 UTC
I think you need to add Japanese in OSX's System Preferences > Language & Text, then put Japanese to the top of the preferred language list.(If I drag "English" to the top of the list, crash does not happen)

For reference, similar "OSX Japanese locale crash" issue in other software.  
https://bugzilla.gnome.org/show_bug.cgi?id=683147
https://github.com/translate/virtaal/issues/3109
Comment 7 guruguru.sp 2016-03-16 01:50:47 UTC
Pre-alpha3(krita3-prealpha3-de0d43d.dmg) still does not run on OSX with Japanese language mode. 
I do see Krita UI displayed, but then Krita shows "Krita cannot find the configuration file! Krita will quit now" dialog, and it quits right away.
Comment 8 guruguru.sp 2016-04-09 02:56:35 UTC
Testing with Krita3-2.99.89.dmg - a slightly different error message("Krita cannot find any brush presets! Krita will quit now.") but still can't run.
Comment 9 guruguru.sp 2016-04-27 13:49:10 UTC
This still happens to me with beta.
ASSERT (krita): "allFiles.size() > 0" in file /Users/boud/dev/krita/libs/ui/KisMainWindow.cpp, line 449
Comment 10 guruguru.sp 2016-06-01 02:02:08 UTC
This is still happening on 3.0 on my Mac and there is a report from another Japanese Krita user on twitter as well.

I tested some more and it seems, Krita is looking at User/<User name>/Library/Application Support/krita/paintoppresets and says "There is no preset" and quits.

I copied a preset from the application package(krita.app/share/krita) to User/<User name>/Library/Application Support/krita/paintoppresets then Krita does run - while most of the resources(non QT ui labels etc) are still missing.

So somehow the correct default resources are not being loaded in Japanese environment and causing this issue.
Comment 11 guruguru.sp 2016-06-01 03:16:53 UTC
I found moving all of krita.app/share contents to krita.app/Resource folder makes Krita work, including UI localization.
Comment 12 Halla Rempt 2016-06-01 06:38:44 UTC
That is strange... Why would a japanese version of OSX look in a different place than the US English version? I'll test that change locally, though, and use it in the next release if it works.
Comment 13 Halla Rempt 2016-06-01 06:40:00 UTC
Hum, that gives exactly the error you were getting, which is not too strange...
Comment 14 guruguru.sp 2016-06-01 10:27:26 UTC
Hi Boud. Sorry I was testing with both
- copying "share/krita" to "User/<User name>/Library/Application Support/"
*and*
- copying "share" content to "resources"

When I re-test with deleting "User/<User name>/Library/Application Support/" Krita tries to launch in Japanese, yet it fails to load presets and quits.

Anyway, I think I found one suspicious difference  in console log. 
XDG_DATA_DIRS setting seems to be wrong when I'm using Japanese as System preferred language.

When I'm using Japanese as MacOS language:
Setting XDG_DATA_DIRS "/../../share"

When I switch to English:
Setting XDG_DATA_DIRS "/Applications/krita.app/Contents/share"
Comment 15 Halla Rempt 2016-06-01 10:31:42 UTC
I'll make an instrumented build of krita to test tonight, with more debug output.
Comment 16 Halla Rempt 2016-06-01 18:28:09 UTC
Could you try

http://www.valdyas.org/~boud/krita-f0cbffc-3.0.dmg

This has the stuff in the Resources folder and the share a link to that. If that doesn't work, I'll make a version with more debug output.
Comment 17 guruguru.sp 2016-06-02 02:07:59 UTC
Created attachment 99321 [details]
log file

Tested the build - Krita does seem to find Japanese locale resource, but it still quits saying "It can't find any presets"
I attach the console log - I still think this line is looking incorrect(incorrect XDG_DATA_DIRS setting causing preset load fail?):
Setting XDG_DATA_DIRS "/../../share"
Comment 18 Halla Rempt 2016-06-02 06:35:49 UTC
Yes, I agree that that's likely the culprit. I'll make the build with more debug info.
Comment 19 Halla Rempt 2016-06-02 06:46:00 UTC
http://doc.qt.io/qt-5/osx-issues.html says:

Note: When OS X is set to use Japanese, a bug causes this sequence to fail and return an empty string. Therefore, always test the returned string.

So that's the issue -- I'll try and find a workaround...
Comment 20 Halla Rempt 2016-06-02 09:34:56 UTC
Could you check http://www.valdyas.org/~boud/krita-f0cbffc-3.0.dmg ?
Comment 21 Halla Rempt 2016-06-02 09:35:47 UTC
The git sha1 is the same, but it's an updated build.
Comment 22 guruguru.sp 2016-06-02 10:16:12 UTC
Created attachment 99324 [details]
new log

Tested the new build: still not finding the preset yet, but here I attach the new log with more debug outputs.
Comment 23 Halla Rempt 2016-06-02 10:22:20 UTC
Comment on attachment 99324 [details]
new log

Thanks! I think we're getting close now -- the workaround for the Japanese OSX bug in Qt worked, now I just need to make sure not to append the ../../.
Comment 24 Halla Rempt 2016-06-02 13:17:39 UTC
Another try: http://www.valdyas.org/~boud/krita-f0cbffc-v3-3.0.dmg (templates are broken, that's known, but I'm curious how far this will get)
Comment 25 guruguru.sp 2016-06-02 13:45:07 UTC
Created attachment 99325 [details]
newest log

Hi boud. Yes! Now Krita does run, and it runs in Japanese. As you have said, templates are not working and I see tags are not present(just "all"), but this is a huge progress :) Thanks so much!
I attach the latest log.
Comment 26 Halla Rempt 2016-06-03 06:28:29 UTC
Git commit cc08247b1b6ed65514ae8b84ffc37019fc744110 by Boudewijn Rempt.
Committed on 03/06/2016 at 06:28.
Pushed by rempt into branch 'krita/3.0'.

See: http://doc.qt.io/qt-5/osx-issues.html which says:

 "Note: When OS X is set to use Japanese, a bug causes
 this sequence to fail and return an empty string.
 Therefore, always test the returned string."

M  +0    -2    libs/ui/KisOpenPane.cpp
M  +0    -2    libs/ui/KisTemplateTree.cpp
M  +26   -18   libs/widgetutils/KoResourcePaths.cpp

http://commits.kde.org/krita/cc08247b1b6ed65514ae8b84ffc37019fc744110
Comment 27 guruguru.sp 2016-06-04 09:52:37 UTC
krita-9e17aff-3.0.dmg runs fine on Japanese OSX(templates load fine as well)!
Comment 28 Halla Rempt 2016-06-04 09:56:15 UTC
:-)