gnosygnu / xowa

xowa offline wiki application
Other
374 stars 41 forks source link

invoke failure for Module:Language #331

Closed desb42 closed 5 years ago

desb42 commented 5 years ago

I have just been trying to rebuild the html for 2019-01-01 enwiki. With no hzip diffing the only errors showing are Module:Language An example is:

20190115_134541.153 invoke failed: Sif {{#invoke:language|wiktlang|{{{1|}}}|{{{2|}}}|{{{3|}}}|i={{{italics|{{{italic|{{{i}}}}}}}}}}} 
[err 0] <gplx> =Module:language:195 No name for the language "goh" could be found
  stack traceback:
  Module:language:184: in function '__index'
  Module:language:233: in function <Module:language:232>
  mw.lua:531: in function <mw.lua:530>
  [Java]: in function '__index'
  d:/des/xowa_x/bin/any/xowa/xtns/Scribunto/engines/Luaj/MWServer.lua:75: 
  in function <d:/des/xowa_x/bin/any/xowa/xtns/Scribunto/engines/Luaj/MWServer.lua:74>

  [Java]: in ?: ttl=Sif excerpt={{#invoke:language|wiktlang|{{{1|}}}|{{{2|}}}|{{{3|}}}|i={{{italics|{{{italic|{{{i}}}}}}}}}}}
  [trace]:
    gplx.xowa.xtns.scribunto.Scrib_core.Handle_error(Scrib_core.java:216)
    gplx.xowa.xtns.scribunto.engines.luaj.Luaj_engine.Dispatch_as_kv_ary(Luaj_engine.java:80)
    gplx.xowa.xtns.scribunto.engines.luaj.Luaj_engine.CallFunction(Luaj_engine.java:59)
    gplx.xowa.xtns.scribunto.Scrib_core.Invoke(Scrib_core.java:182)
    gplx.xowa.xtns.scribunto.Scrib_invoke_func.Func_evaluate(Scrib_invoke_func.java:60)
    gplx.xowa.parsers.tmpls.Xot_invk_tkn_.Eval_func(Xot_invk_tkn_.java:30)
    gplx.xowa.parsers.tmpls.Xot_invk_tkn.Tmpl_evaluate(Xot_invk_tkn.java:258)
    gplx.xowa.parsers.tmpls.Xot_defn_tmpl.Tmpl_evaluate(Xot_defn_tmpl.java:86)
    gplx.xowa.parsers.tmpls.Xot_invk_tkn.Tmpl_evaluate(Xot_invk_tkn.java:288)
    gplx.xowa.parsers.tmpls.Xot_tmpl_wtr.Write_tkn(Xot_tmpl_wtr.java:101)
    gplx.xowa.parsers.tmpls.Xot_tmpl_wtr.Write_tkn(Xot_tmpl_wtr.java:33)
    gplx.xowa.parsers.tmpls.Xot_tmpl_wtr.Write_all(Xot_tmpl_wtr.java:22)
    gplx.xowa.parsers.Xop_parser.Expand_tmpl(Xop_parser.java:50)
    gplx.xowa.parsers.Xop_parser.Expand_tmpl(Xop_parser.java:44)
    gplx.xowa.parsers.Xop_parser.Parse_text_to_wdom(Xop_parser.java:102)
    gplx.xowa.parsers.Xow_parser_mgr.Parse(Xow_parser_mgr.java:98)
    gplx.xowa.wikis.pages.Xowe_page_mgr.Load_page(Xowe_page_mgr.java:91)
    gplx.xowa.apps.servers.http.Http_server_mgr.Parse_page_to_html(Http_server_mgr.java:128)
    gplx.xowa.apps.servers.http.Http_server_wkr.Write_wiki(Http_server_wkr.java:111)
    gplx.xowa.apps.servers.http.Http_server_wkr.Process_get(Http_server_wkr.java:82)
    gplx.xowa.apps.servers.http.Http_server_wkr.Run(Http_server_wkr.java:60)
    gplx.xowa.apps.servers.http.Http_server_wkr.Invk(Http_server_wkr.java:229)
    gplx.Gfo_invk_.Invk_by_msg(Gfo_invk_.java:34)
    gplx.core.threads.Thread_adp.run(Thread_adp.java:33)
    java.lang.Thread.run(Thread.java:748)

The first small issue (not the main one) is that the report =Module:language:195 which I take to mean line number, is incorrect - this should be line 193 The second (still not the main issues) is that I expect a lua error to generate a red error message That is, on wikipedia, {{wikt-lang|xon|sifjar}} where 'xon' is an invalid language we get rederr

To the main issue, the language 'goh' is 'defined' in CldrNamesEn.json in the mediawiki cldr extension (which I believe is a relatively new extension to xowa) as 'Old High German' In Module:Language in function linkToWiktionary (line 183) mw.language.fetchLanguageName is called In xowa this ends up in Scrib_lib_language.java Line 132 public boolean FetchLanguageName at line 135 String include = args.Cast_str_or(2, "mw"); If there is a value, use it or default to 'mw' This is where I believe the issue is. The Xol_name_mgr.java fetchLanguageName function defaults the 'include' parameter to 'all'

when line 135 of Scrib_lib_language.java is set to default to 'all', this gives the correct response with no error

gnosygnu commented 5 years ago

Hey, as always, thanks for the detailed write-up. Responding to your points:

The first small issue (not the main one) is that the report =Module:language:195 which I take to mean line number, is incorrect - this should be line 193

Yeah, I think this is either a LuaJ issue . If I remember correctly, the line-number is coming from their call-stack. XOWA doesn't get involved except for reporting LuaJ's call-stack. Let me know if you think otherwise

The second (still not the main issues) is that I expect a lua error to generate a red error message That is, on wikipedia, {{wikt-lang|xon|sifjar}} where 'xon' is an invalid language we get

Not sure I follow. I ran {{wikt-lang|xon|sifjar}} in XOWA at en.wikipedia.org/wiki/Wikipedia:Sandbox?action=edit. It displays the error message in red.

Which page are you seeing the error message not displayed in red?

at line 135 String include = args.Cast_str_or(2, "mw"); If there is a value, use it or default to 'mw'

Thanks. That helped a lot (though admittedly, it still took longer than it should have on my side). The problem was a bad transcription from MediaWiki to XOWA. It should have been null not 'mw'. I changed it in the commit above. I also added the "correct" implementation for fetchLanguageNames, though I don't have a real way to test it.

Let me know if there's anything else. Thanks.

desb42 commented 5 years ago

In respect of the red error message, I think this is related to my response in #335 (Wrong luaj_xowa.jar version) The red message now appears

gnosygnu commented 5 years ago

Cool. Thanks. I think this issue is closeable then. Let me know if there's anything else.

gnosygnu commented 5 years ago

I also added the "correct" implementation for fetchLanguageNames, though I don't have a real way to test it.

While working on #337, I discovered this was broken. I found this during a runtime test at this page: home/wiki/Diagnostics/Scribunto/All . It's fixed with the commit above.