Hi, apologies in advance as I am only a casual lua user and only
moonlight on zOS (IBM's big-endian, ebcdic, mainframe OS) where this
is a problem.
I maintain a distribution of Apache HTTP Server on this platform,
which has lua extensions. It seems something between 5.4.8 and 5.5.0
has regressed the basics of the integration between the two.
We don't customize luaconf.h at all and this also works on 5.2.4.
When Apache invokes a very simple lua script, after just a very few
calls through our metatable, calling a C function will error out on:
> attempt to index a number value (local 'r')
Unfortunately I have not been able to reproduce it in a standalone
testcase. Additionally, seemingly innocuous things added to the lua
script make it work again -- these were originally side effects of
longer debug snippets. The smallest Apache-based testcase has some
embedded comments that illustrate this aspect:
function handle(r)
r.content_type = "text/plain"
-- fixes "attempt to index a number value..."
-- local d = debug.getregistry()
-- also works
-- local c= collectgarbage()
-- but not just:
-- collectgarbage()
if r.method == 'GET' then
r:puts("Hello Lua World!\n")
-- this small example fails on the second call
r:puts("Hello Lua World!\n")
end
end
The essence of what we do is here:
https://github.com/apache/httpd/blob/5bf7c9c34e5091894993b43a42639a3fd10d1418/modules/lua/lua_request.c#L2683
https://github.com/apache/httpd/blob/5bf7c9c34e5091894993b43a42639a3fd10d1418/modules/lua/lua_request.c#L2987
https://github.com/apache/httpd/blob/5bf7c9c34e5091894993b43a42639a3fd10d1418/modules/lua/lua_request.c#L1895
I also maintain this stack on AIX, another big endian platform, and
see no problem with 5.5.0.
During some AI driven debugging, whose fixes to
packing/padding/masking never panned out, the theory was that the
macros that isolate parts of each Instruction were suffering from some
s390x-specific problem resulting in very large values being seen for
"ARG A" such as 0x088DD000 instead of very small values.
Please let me know if there is any useful thing to try. Thanks!
--
Eric Covener
cov...@gmail.com