Skip to content
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

Crash on emulator startup (./kodev run) on macOS 10.15.1 #6873

Closed
Witos opened this issue Nov 13, 2020 · 11 comments · Fixed by #6874
Closed

Crash on emulator startup (./kodev run) on macOS 10.15.1 #6873

Witos opened this issue Nov 13, 2020 · 11 comments · Fixed by #6874
Assignees
Labels
Milestone

Comments

@Witos
Copy link

Witos commented Nov 13, 2020

  • KOReader version:
    v2020.10.1-47-g1468646a_2020-11-13
  • Device:
    macOS 10.15.1 (Macbook)

Issue

./kodev run crashes on startup

Steps to reproduce

export PATH="/usr/local/opt/gettext/bin:${PATH}"
export MACOSX_DEPLOYMENT_TARGET=10.14
./kodev run

Attaching log from the run.
crash.log

@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

What's your system language? This doesn't look related to macOS (a welcome change :-P) but I can't quite tell what the problem might be.

Basically the output of these commands:

echo $LANGUAGE
echo $LC_ALL
echo $LC_MESSAGES
echo $LANG

With any luck it should be reproducible anywhere.

@Witos
Copy link
Author

Witos commented Nov 13, 2020

Nice. Those above where empty, setting $LANG helped.

@Witos Witos closed this as completed Nov 13, 2020
@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

@Witos I'd still like to figure out the root cause. ;-)

@Frenzie Frenzie reopened this Nov 13, 2020
@Frenzie Frenzie added the bug label Nov 13, 2020
@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

Without setting anything manually (and you might have to clear settings too), does something like this output anything?

diff --git a/frontend/gettext.lua b/frontend/gettext.lua
index 85e3f9fb..d0a4da12 100644
--- a/frontend/gettext.lua
+++ b/frontend/gettext.lua
@@ -167,6 +167,8 @@ end
 -- we only implement a sane subset for now
 
 function GetText_mt.__index.changeLang(new_lang)
+print("new_lang", new_lang)
+error()
     GetText.context = {}
     GetText.translation = {}
     GetText.current_lang = "C"

@Witos
Copy link
Author

Witos commented Nov 13, 2020

Tested:

  1. Applied patch
  2. Unset LANG
    3 ./kodev build && ./kodev run
  3. Your print is not hit:

./kodev run | grep "new_lang"
./luajit: frontend/gettext.lua:386: attempt to index field 'context' (a nil value)
stack traceback:
frontend/gettext.lua:386: in function 'C_'
frontend/ui/data/strings.lua:81: in main chunk
[C]: in function 'require'
frontend/ui/data/creoptions.lua:3: in main chunk
[C]: in function 'require'
frontend/apps/reader/modules/readerconfig.lua:7: in main chunk
[C]: in function 'require'
frontend/apps/reader/readerui.lua:27: in main chunk
[C]: in function 'require'
frontend/apps/cloudstorage/dropbox.lua:8: in main chunk
[C]: in function 'require'
frontend/apps/cloudstorage/cloudstorage.lua:6: in main chunk
[C]: in function 'require'
frontend/apps/filemanager/filemanagermenu.lua:3: in main chunk
[C]: in function 'require'
frontend/apps/filemanager/filemanager.lua:18: in main chunk
[C]: in function 'require'
./reader.lua:270: in main chunk
[C]: at 0x01000ef1d0

@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

What exactly did you set LANG to, btw?

@Witos
Copy link
Author

Witos commented Nov 13, 2020

I unset it.

unset LANG
env | grep "LANG"

@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

But what did you set it to when you set it?

@Witos
Copy link
Author

Witos commented Nov 13, 2020

image
Then it's fine ^

@Frenzie
Copy link
Member

Frenzie commented Nov 13, 2020

Thanks, I think I know the issue thanks to that. Could you please try this?

diff --git a/frontend/gettext.lua b/frontend/gettext.lua
index 85e3f9fb..92c7c081 100644
--- a/frontend/gettext.lua
+++ b/frontend/gettext.lua
@@ -23,6 +23,7 @@ local isAndroid, android = pcall(require, "android")
 local logger = require("logger")
 
 local GetText = {
+    context = {},
     translation = {},
     current_lang = "C",
     dirname = "l10n",

@Frenzie Frenzie self-assigned this Nov 13, 2020
@Frenzie Frenzie added this to the 2020.11 milestone Nov 13, 2020
Frenzie added a commit to Frenzie/koreader that referenced this issue Nov 13, 2020
In case of no environment language. I suppose that doesn't tend to happen much in the wild since I added the offending code early in 2020. ;-)

Fixes <koreader#6873>.
@Witos
Copy link
Author

Witos commented Nov 13, 2020

Works with LANG unset. Thanks!

Frenzie added a commit that referenced this issue Nov 13, 2020
In case of no environment language. I suppose that doesn't tend to happen much in the wild since I added the offending code early in 2020. ;-)

Fixes <#6873>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants