diff mbox

[15/25] luaposix: fix runtime by selecting "bit32" instead of "bitop"

Message ID 20170223170047.24417-16-arnout@mind.be
State Accepted
Headers show

Commit Message

Arnout Vandecappelle Feb. 23, 2017, 5 p.m. UTC
Since the bump of luaposix to 33.4.0, it doesn't work anymore at
runtime with LuaJIT or Lua 5.1. This can be tested with the following
defconfig:

BR2_x86_64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_PACKAGE_LUA=y
BR2_PACKAGE_LUA_5_1=y
BR2_PACKAGE_LUAPOSIX=y

/usr/bin/lua: /usr/share/lua/5.1/posix/init.lua:17: module 'bit32' not found:
...

In older luaposix versions, it would try to load the 'bit' instead of
'bit32' module if LUAVER == 5.1. However, this feature was removed in
33.4.0.

So instead of adding a runtime dependency on luabitop, depend on
lua-bit32.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 package/luaposix/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni March 2, 2017, 9:58 p.m. UTC | #1
Hello,

On Thu, 23 Feb 2017 18:00:37 +0100, Arnout Vandecappelle
(Essensium/Mind) wrote:
> Since the bump of luaposix to 33.4.0, it doesn't work anymore at
> runtime with LuaJIT or Lua 5.1. This can be tested with the following
> defconfig:
> 
> BR2_x86_64=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_LUA=y
> BR2_PACKAGE_LUA_5_1=y
> BR2_PACKAGE_LUAPOSIX=y
> 
> /usr/bin/lua: /usr/share/lua/5.1/posix/init.lua:17: module 'bit32' not found:
> ...

This smells like an excellent candidate for a runtime test in the test
infrastructure, no? :-)

> In older luaposix versions, it would try to load the 'bit' instead of
> 'bit32' module if LUAVER == 5.1. However, this feature was removed in
> 33.4.0.
> 
> So instead of adding a runtime dependency on luabitop, depend on
> lua-bit32.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Applied, thanks!

Thomas
Arnout Vandecappelle March 2, 2017, 10:25 p.m. UTC | #2
On 02-03-17 22:58, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 23 Feb 2017 18:00:37 +0100, Arnout Vandecappelle
> (Essensium/Mind) wrote:
>> Since the bump of luaposix to 33.4.0, it doesn't work anymore at
>> runtime with LuaJIT or Lua 5.1. This can be tested with the following
>> defconfig:
>>
>> BR2_x86_64=y
>> BR2_TOOLCHAIN_EXTERNAL=y
>> BR2_PACKAGE_LUA=y
>> BR2_PACKAGE_LUA_5_1=y
>> BR2_PACKAGE_LUAPOSIX=y
>>
>> /usr/bin/lua: /usr/share/lua/5.1/posix/init.lua:17: module 'bit32' not found:
>> ...
> 
> This smells like an excellent candidate for a runtime test in the test
> infrastructure, no? :-)

 Since the runtime test infra hasn't been committed yet, I didn't do that :-)

 Regards,
 Arnout

> 
>> In older luaposix versions, it would try to load the 'bit' instead of
>> 'bit32' module if LUAVER == 5.1. However, this feature was removed in
>> 33.4.0.
>>
>> So instead of adding a runtime dependency on luabitop, depend on
>> lua-bit32.
>>
>> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
> Applied, thanks!
> 
> Thomas
>
Thomas Petazzoni March 2, 2017, 10:28 p.m. UTC | #3
Hello,

On Thu, 23 Feb 2017 18:00:37 +0100, Arnout Vandecappelle
(Essensium/Mind) wrote:
> Since the bump of luaposix to 33.4.0, it doesn't work anymore at
> runtime with LuaJIT or Lua 5.1. This can be tested with the following
> defconfig:
> 
> BR2_x86_64=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_LUA=y
> BR2_PACKAGE_LUA_5_1=y
> BR2_PACKAGE_LUAPOSIX=y
> 
> /usr/bin/lua: /usr/share/lua/5.1/posix/init.lua:17: module 'bit32' not found:
> ...
> 
> In older luaposix versions, it would try to load the 'bit' instead of
> 'bit32' module if LUAVER == 5.1. However, this feature was removed in
> 33.4.0.
> 
> So instead of adding a runtime dependency on luabitop, depend on
> lua-bit32.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

Now that I think more about this, I believe PATCH 14/25 and 15/25
should be merged into the LTS branch, since they fix a runtime issue
with Lua.

I believe even though they show up as patches 14 and 15 in the series,
they don't depend on any of the previous patches.

Peter, what do you think?

Thomas
Arnout Vandecappelle March 2, 2017, 11:02 p.m. UTC | #4
On 02-03-17 23:28, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 23 Feb 2017 18:00:37 +0100, Arnout Vandecappelle
> (Essensium/Mind) wrote:
>> Since the bump of luaposix to 33.4.0, it doesn't work anymore at
>> runtime with LuaJIT or Lua 5.1. This can be tested with the following
>> defconfig:
>>
>> BR2_x86_64=y
>> BR2_TOOLCHAIN_EXTERNAL=y
>> BR2_PACKAGE_LUA=y
>> BR2_PACKAGE_LUA_5_1=y
>> BR2_PACKAGE_LUAPOSIX=y
>>
>> /usr/bin/lua: /usr/share/lua/5.1/posix/init.lua:17: module 'bit32' not found:
>> ...
>>
>> In older luaposix versions, it would try to load the 'bit' instead of
>> 'bit32' module if LUAVER == 5.1. However, this feature was removed in
>> 33.4.0.
>>
>> So instead of adding a runtime dependency on luabitop, depend on
>> lua-bit32.
>>
>> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
> Now that I think more about this, I believe PATCH 14/25 and 15/25
> should be merged into the LTS branch, since they fix a runtime issue
> with Lua.
> 
> I believe even though they show up as patches 14 and 15 in the series,
> they don't depend on any of the previous patches.

 Indeed, I intentionally created the lua-bit32 package first without all the
niceties in the luarocks-package infra, and then factored the complexity in the
infra, to make it easy to apply only the fix and not the refactoring.

 Actually, for my customer I just applied the lua-bit32 patch (in a
BR2_EXTERNAL) and it is selected manually, so I am sure it works like that.

 Regards,
 Arnout
diff mbox

Patch

diff --git a/package/luaposix/Config.in b/package/luaposix/Config.in
index 9707cdeeff..91abcb9e32 100644
--- a/package/luaposix/Config.in
+++ b/package/luaposix/Config.in
@@ -1,8 +1,10 @@ 
 config BR2_PACKAGE_LUAPOSIX
 	bool "luaposix"
 	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
-	select BR2_PACKAGE_LUABITOP if BR2_PACKAGE_LUA_5_1
-	# LuaBitOp is already included in LuaJIT
+	# "bit32" is included in Lua 5.2+. luajit has an equivalent
+	# "bit" module, but since it has a different name, luaposix
+	# doesn't find it.
+	select BR2_PACKAGE_LUA_BIT32 if BR2_PACKAGE_LUA_5_1 || BR2_PACKAGE_LUAJIT
 	help
 	  This is a POSIX binding for LuaJIT, Lua 5.1, 5.2 and 5.3;
 	  like most libraries it simply binds to C APIs on the