Extension talk:Scribunto

Jump to navigation Jump to search

About this board

  • This page uses "Flow".
  • It has most recently started discussions at the top.
  • The page loads dynamically, meaning you can't tell how much more you will see when you scroll down
Kyler85 (talkcontribs)

Hi, I've spent over a week trying to add infobox's to my wiki with no luck, currently I get this error when I import my Wikipedia template "Lua error: Internal error: The interpreter has terminated with signal "11"." Here's a page on my wiki that has this error. Any help is appreciated. I'm running on a CloudLinux shared server and you can see my wiki's software versions and extensions here

Tacsipacsi (talkcontribs)

I see no such error message. Did you change anything in the configuration since the above message?

Reply to "Error attempting to add infobox's"

chcon: can't apply partial context to unlabeled file ‘lua’

8
AndyPKU (talkcontribs)

When I follow the manual instruction, and did "chcon -t httpd_sys_script_exec_t /path/to/extensions/Scribunto/engines/LuaStandalone/binaries/yourOS/lua" this, it sais that can't aplly partial context to unlabeled file 'lua'. What should I do?

Dinoguy1000 (talkcontribs)

Did you change the system path as appropriate for your environment? The path shown on the page is only a sample and won't work verbatim unless you intentionally set up your server with that directory structure. Specifically, the /path/to/extensions refers to the /extensions directory in MediaWiki's base directory; on a default server this might therefore be /var/www/html/extensions. Additionally, the /yourOS directory is just an example and needs to be replaced as appropriate; check what directories are contained in /extensions/Scribunto/engines/LuaStandalone/binaries and select the correct one for the operating system your server is running.

AndyPKU (talkcontribs)

in fact, my lua is in the path /var/www/html/extension/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic,and I use the command CD into this directory and use command as chcon -t httpd_sys_script_exec_t lua, I am not sure whether it is suitable, but I take it for grunted..

83.77.23.177 (talkcontribs)

Same issue here.

Trying with chcon -t httpd_sys_script_exec_t /var/www/mediawiki/extensions/Scributon/engines/LuaStandalone/binaries/lua5_1_5_linux_32_generic/lua sends the same error my way.

I am trying to setup my wiki using a Raspberry Pi 3, using 32-bit Raspbian.

185.43.188.16 (talkcontribs)

Have anybody resolved this problem? What was the reason?

118.148.171.25 (talkcontribs)

same problem here, tried running using just lua (from inside the 1_5_* folder) as well as using proper paths


47.232.131.137 (talkcontribs)

Is anyone gonna address this issue?!

73.225.196.93 (talkcontribs)

same issue here

Reply to "chcon: can't apply partial context to unlabeled file ‘lua’"
Carn (talkcontribs)

Could you please tell me where to get the code for Wikipedia-specific functions (mw. family)?

Mr. Stradivarius (talkcontribs)
Reply to "mw.lua"

chcon: can't apply partial context to unlabeled file...

2
37.195.1.41 (talkcontribs)

When I follow the manual instruction, and did "chcon -t httpd_sys_script_exec_t var/www/html/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic/lua" this, it sais that can't aplly partial context to unlabeled file. What should I do?

var/www/html/extension is way to extension folder.

Tacsipacsi (talkcontribs)

I’m not familiar with SELinux, but just to make sure: your extension directory is /var/www/html/extensions, that is, with a leading slash. var/www/html/extensions is a relative path, and its meaning depends on the current working directory, so it only works if your working directory happens to be the root directory (/). If your working directory is, for example, /home/joe, it means /home/joe/var/www/html/extensions, which is rarely a web-accessible directory.

Reply to "chcon: can't apply partial context to unlabeled file..."

Lua error in Module:Navbar at line 62: Invalid title {{subst:PAGENAME}}.

9
Chenpanxyz (talkcontribs)

I followed Manual:Importing Wikipedia infoboxes tutorial to import the infoboxes from Wikipedia.

My mediawiki is version 1.34.

I have Scribunto installed.

When I checked mywiki/Template:Infobox. I got the following error: Lua error in Module:Navbar at line 62: Invalid title {{subst:PAGENAME}}.

The backtrace is:

Lua error in Module:Navbar at line 62: Invalid title {{subst:PAGENAME}}.

Backtrace:

  1. (tail call): ?
  2. [C]: in function "error"
  3. Module:Navbar:62: in function "navbar"
  4. Module:Infobox:256: in function "renderNavBar"
  5. Module:Infobox:322: ?
  6. (tail call): ?
  7. mw.lua:511: ?
  8. (tail call): ?
  9. [C]: in function "xpcall"
  10. MWServer.lua:99: in function "handleCall"
  11. MWServer.lua:313: in function "dispatch"
  12. MWServer.lua:70: ?
  13. (tail call): ?
  14. mw.lua:169: ?
  15. Module:Arguments:254: ?
  16. Module:Documentation:650: in function "_content"
  17. Module:Documentation:140: ?
  18. (tail call): ?
  19. mw.lua:511: ?
  20. (tail call): ?
  21. [C]: in function "xpcall"
  22. MWServer.lua:99: in function "handleCall"
  23. MWServer.lua:313: in function "dispatch"
  24. MWServer.lua:52: in function "execute"
  25. mw_main.lua:7: in main chunk
  26. [C]: ?

Any help would be greatly appreciated. I have spent the whole day trying to figure it out but didn't make it.

Thanks.

Tacsipacsi (talkcontribs)

You should not place {{subst:PAGENAME}} in an <includeonly> block (in wiki code). Either remove the <includeonly> and </includeonly> tags, or manually replace {{subst:PAGENAME}} with the actual template name.

Chenpanxyz (talkcontribs)

But I didn't write the code, I just imported from Wikipedia. Thanks.

Tacsipacsi (talkcontribs)

Yes, you did write the template code. It’s not about the Lua module, it’s about the navbox you created using the module. Or what Wikipedia navbox did you import?

65.93.136.82 (talkcontribs)

Hi, thanks for replying so fast!

I didn't create any navbox, neither did I import any from Wikipedia. I just imported infobox and infobox/doc. And then I got this error at /Template:Info at the beginning of examples section (Template:Infobox#Examples).

Tacsipacsi (talkcontribs)

The code snippets containing {{subst:PAGENAME}} should not be executed to begin with. Do you have Extension:SyntaxHighlight installed?

Chenpanxyz (talkcontribs)

No. I don't have this extension. Is this the reason?

Tacsipacsi (talkcontribs)

Yes.

Chenpanxyz (talkcontribs)

Thank you so much. It fixed the issue!

Happy New Year!

Reply to "Lua error in Module:Navbar at line 62: Invalid title {{subst:PAGENAME}}."

Lua error: bad argument #1 to "get" (not a valid title).

3
Wsdmatty (talkcontribs)

I have recently begun a quest to import Template:Quote to my wiki. This was not straightforward and took a lot more time than I anticipated. However, through trial and error and muddling my way through extension installations, I have finally got the template working.

However, Template:Documentation is giving me a Lua error. I don't know if it's mental fatigue or my brain has just given up, but i can't figure out what the actual problem is. Any suggestions would be greatly appreciated.

BT:

Lua error: bad argument #1 to "get" (not a valid title).

Backtrace:

  1. (tail call): ?
  2. [C]: in function "error"
  3. MWServer.lua:81: ?
  4. (tail call): ?
  5. (tail call): ?
  6. Module:TNT:162: in function "loadData"
  7. Module:TNT:181: ?
  8. (tail call): ?
  9. (tail call): ?
  10. Module:Documentation/config:63: in function "init"
  11. package.lua:103: ?
  12. (tail call): ?
  13. mw.lua:486: in function "executeModule"
  14. mw.lua:762: in function "loadData"
  15. Module:Documentation:8: in function "chunk"
  16. mw.lua:486: ?
  17. (tail call): ?
  18. [C]: in function "xpcall"
  19. MWServer.lua:99: in function "handleCall"
  20. MWServer.lua:313: in function "dispatch"
  21. MWServer.lua:70: ?
  22. (tail call): ?
  23. (tail call): ?
  24. (tail call): ?
  25. mw.lua:511: ?
  26. (tail call): ?
  27. [C]: in function "xpcall"
  28. MWServer.lua:99: in function "handleCall"
  29. MWServer.lua:313: in function "dispatch"
  30. MWServer.lua:52: in function "execute"
  31. mw_main.lua:7: in main chunk
  32. [C]: ?


Tacsipacsi (talkcontribs)

Did you set JsonConfig up? The relevant parts from Wikimedia’s CommonSettings.php are:

// Safety: before extension.json, these values were initialized by JsonConfig.php
if ( !isset( $wgJsonConfigModels ) ) {
	$wgJsonConfigModels = [];
}
if ( !isset( $wgJsonConfigs ) ) {
	$wgJsonConfigs = [];
}

$wgJsonConfigEnableLuaSupport = true;

// https://www.mediawiki.org/wiki/Extension:JsonConfig#Configuration

$wgJsonConfigModels['Tabular.JsonConfig'] = 'JsonConfig\JCTabularContent';
$wgJsonConfigs['Tabular.JsonConfig'] = [
	'namespace' => 486,
	'nsName' => 'Data',
	// page name must end in ".tab", and contain at least one symbol
	'pattern' => '/.\.tab$/',
	'license' => 'CC0-1.0',
	'isLocal' => false,
];

// Enable Tabular data namespace on Commons - T148745
$wgJsonConfigInterwikiPrefix = 'commons';
$wgJsonConfigs['Tabular.JsonConfig']['remote'] = [
	'url' => 'https://commons.wikimedia.org/w/api.php'
];
Wsdmatty (talkcontribs)

Thank you very much for this. I had not set it up properly but this fixed my problem.

Reply to "Lua error: bad argument #1 to "get" (not a valid title)."

importing templates/modules after upgrade

3
Johanverdoodt (talkcontribs)

Dear,


An exisisting MW 1.8 has been upgraded to 1.31

Database has resortored and extensions have been upgraded.

Although I can import Templates (exported with all versions) and modules, I get the following errors....

I have no clue anymore... anyone ?


Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value). Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).

Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).


Lua error in Module:TNT at line 157: attempt to index field 'data' (a nil value).

Backtrace:

  1. (tail call): ?
  2. Module:TNT:157: in function "loadData"
  3. Module:TNT:176: ?
  4. (tail call): ?
  5. mw.lua:511: ?
  6. (tail call): ?
  7. [C]: in function "xpcall"
  8. MWServer.lua:99: in function "handleCall"
  9. MWServer.lua:313: in function "dispatch"
  10. MWServer.lua:52: in function "execute"
  11. mw_main.lua:7: in main chunk
  12. [C]: ?
Mr. Stradivarius (talkcontribs)

It looks like you need to install Extension:TemplateData. Module:TNT (or at least the module of that name that I checked on the English Wikipedia) uses this extension at line 157. It also tries to load TemplateData datasets from Wikimedia Commons, so you will probably also need to make "c:" a valid interwiki prefix for Wikimedia Commons from your wiki, if it isn't already.

Tacsipacsi (talkcontribs)

The lack of TemplateData would just garbage output, I don’t think it would throw an error. What gives this error is the lack of Extension:JsonConfig (or lack of proper setup). A recent edit to the module gives a more useful error message in this specific case.

Reply to "importing templates/modules after upgrade"

On having a lot of random bugs during testing

1
Jeblad (talkcontribs)

This extension have a nasty habit of throwing really weird errors during unit tests in Vagrant. I've been asking several people about the real root cause for this, but the explanation goes from slightly wrong to complete whimsical. When it is present it only affects the sandboxed environment, so a known fix is to use the standalone environment. That has a real impact in production, but for testing it works. (Actually, if you turn off one of the environments the tests goes at least twice as fast. Pretty obvious as it runs the tests in both environments, and the setup consumes most (or a lot) of the time spent in a test, thus turning one of the two test sets off will make the tests run faster.)

The fun thing is; I've experienced the problems on both Ubuntu and Win10, on two different machines. My two different machines has in fact the same motherboard and nearly the same CPU from AMD.

Backtracking what I did when the bug (?) turned up and later when it disappeared, made me wonder if has something to do with the microcode for avoiding the Spectre vulnerability. It seems to have hit when Ubuntu included an update that had a reference to the micocode, and later it seems to have disappeared when there were another update also involving the microcode.

It is a rather weak correlation here, so whether it was the real root cause is unclear, but if you get a lot of really weird errors while running unit tests try to run a newer version of your OS. If that does not help, and you have enough server juice, use the standalone version.

For another discussion on the topic, see Luasandbox gives a sigsegv. Yes, it is weird.

Reply to "On having a lot of random bugs during testing"
Summary by Carn

Yes Done text entry proposal was implemented by the author Carn (talk) 11:49, 6 December 2019 (UTC)

Carn (talkcontribs)

There is info from Russian Lua FAQ:

Under the module editing window there are two useful fields. In one of them you can enter the name of an existing page and see how the changed version of the module will work on it. The second is the debugger window. There you can enter any line of text on Lua; debugging of the fn function, which is planned to be used in the call {{#invoke: Module | fn | a1 | a2 | un = ua | a3}}, usually looks like this:

=p.fn{args={"a1","a2",["un"]="ua","a3"}} --simplest case
=p.fn(mw.getCurrentFrame():newChild{title="dont matter",args={"a1","a2",["un"]="ua","a3"}}) --if the function involves using the methods of the frame object
=p.fn(mw.getCurrentFrame():newChild{title="Template:SHA",args={"sha1","sha2",["ASH"]="SAH"}}:newChild{title="Module:Current",args={"a1","a2",["un"]="ua","a3"}})
 --if we test the function for application through the template {{SHA| sha1| sha2| ASH= SAH}}, the most accurate way

I think this information will be useful. However, this debugging method doesn’t work for me - the parameters are not passed to the module. Therefore, I do not add this instruction myself.Carn (talk) 08:16, 6 December 2019 (UTC)

SANtosito (talkcontribs)

I'm trying to make syntax highlighting working in modules but apparently sth is missing. I have installed WikiEditor, SyntaxHighlight, CodeEditor and have done everything as said in manual. All installed extension are working , just seems it dosen't work with Scribunto, so I guess the problem must be sth else

wfLoadExtension( 'WikiEditor' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'CodeEditor' );

wfLoadExtension( 'Scribunto' );

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['key'] = 'value';

$wgScribuntoUseGeSHi = true;

$wgScribuntoUseCodeEditor = true;

http://escforumwiki.com/index.php?title=Module:Documentation

WikimeSteve (talkcontribs)

I do not see a solution and outcome here. I am having the same issue. We do not have CodeEditor installed though. Is that required?

Syntax highlighting is working on all other pages as expected. With the following should we see module syntax highlighting or do we need anything else?

$wgScribuntoDefaultEngine = 'luastandalone';

$wgScribuntoEngineConf['luastandalone']['key'] = 'value';

$wgScribuntoUseGeSHi = true;

wfLoadExtension( 'WikiEditor' );

wfLoadExtension( 'SyntaxHighlight_GeSHi' );

wfLoadExtension( 'Scribunto' );


Update: I just copied the Lua code from a Module window. Pasted it into a blank page and surrounded it with <syntaxhighlight lang="Lua">. When I click show demo it was all nice and colorful and matches how it looks on the same module on Wikipedia. So our SyntaxHighlight seems fine. The Module view just does not show it on our Wiki.

Reply to "Syntax highlighting not working"