Project

General

Profile

Bug #2674

Add Lua 5.2 support

Added by pkubaj about 2 years ago. Updated almost 2 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
Category:
mod_magnet
Target version:
Start date:
2015-09-29
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:
No

Description

I'm a Lighttpd maintainer for FreeBSD and I'm currently trying to make Lighttpd use Lua 5.2. For now, I've got a following patch:

--- src/mod_magnet.c.orig       2015-08-29 14:22:38.000000000 +0200
+++ src/mod_magnet.c    2015-09-29 11:46:30.312599419 +0200
@@ -24,6 +24,10 @@
 #define MAGNET_CONFIG_PHYSICAL_PATH "magnet.attract-physical-path-to" 
 #define MAGNET_RESTART_REQUEST      99

+#if LUA_VERSION_NUM >= 502
+#define LUA_GLOBALSINDEX LUA_REGISTRYINDEX
+#endif
+
 /* plugin config for all request/connections */

 static jmp_buf exceptionjmp;
@@ -688,7 +692,11 @@
         * get the environment of the function
         */

+#if LUA_VERSION_NUM >= 502
+       lua_getuservalue(L, -1); /* -1 is the function */
+#else
        lua_getfenv(L, -1); /* -1 is the function */
+#endif

        /* lighty.header */                                                                                                

@@ -738,7 +746,11 @@
         */

        force_assert(lua_isfunction(L, -1));
+#if LUA_VERSION_NUM >= 502
+       lua_getuservalue(L, -1); /* -1 is the function */
+#else
        lua_getfenv(L, -1); /* -1 is the function */
+#endif

        lua_getfield(L, -1, "lighty"); /* lighty.* from the env  */
        force_assert(lua_istable(L, -1));
@@ -988,7 +1000,11 @@
        lua_setmetatable(L, -2); /* setmetatable({}, {__index = _G}) (sp -= 1) */

+#if LUA_VERSION_NUM >= 502
+       lua_setuservalue(L, -2); /* on the stack should be a modified env (sp -= 1) */
+#else
        lua_setfenv(L, -2); /* on the stack should be a modified env (sp -= 1) */
+#endif

        errfunc = push_traceback(L, 0);
        if (lua_pcall(L, 0, 1, errfunc)) {

For now it compiles and after enabling mod_magnet Lighttpd starts fine, but using Lua makes Lighttpd return 503.

patch-src_mod__magnet.c (1.31 KB) patch-src_mod__magnet.c pkubaj, 2015-09-29 10:01

Related issues

Has duplicate Bug #2421: lighttpd 1.4.31 is not compatible with lua 5.2.1Duplicate2012-06-26

Associated revisions

Revision 75a518bd (diff)
Added by stbuehler about 2 years ago

add handling for lua 5.2 and 5.3 (fixes #2674)

Reviewers: stbuehler

Differential Revision: https://review.lighttpd.net/D4

Revision 3070 (diff)
Added by stbuehler almost 2 years ago

add handling for lua 5.2 and 5.3 (fixes #2674)

Reviewers: stbuehler

Differential Revision: https://review.lighttpd.net/D4

From: Stefan Bühler <>

Revision c354229f (diff)
Added by stbuehler almost 2 years ago

add handling for lua 5.2 and 5.3 (fixes #2674)

Reviewers: stbuehler

Differential Revision: https://review.lighttpd.net/D4

From: Stefan Bühler <>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3070 152afb58-edef-0310-8abb-c4023f1b3aa9

History

#1

Updated by stbuehler about 2 years ago

  • Description updated (diff)
#2

Updated by stbuehler about 2 years ago

Can you please test the patch at https://review.lighttpd.net/D4 ?

#3

Updated by pkubaj about 2 years ago

stbuehler wrote:

Can you please test the patch at https://review.lighttpd.net/D4 ?

The patching fails with:
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
-------------------------- |diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt |--- a/src/CMakeLists.txt |+++ b/src/CMakeLists.txt
--------------------------
Patching file CMakeLists.txt using Plan A...
No such line 396 in input file, ignoring
Hunk #1 failed at 397.
1 out of 1 hunks failed--saving rejects to CMakeLists.txt.rej

#4

Updated by pkubaj about 2 years ago

Sorry, it works using svn patch instead of patch.

#5

Updated by stbuehler about 2 years ago

  • Target version changed from 1.4.38 to 1.4.39
#6

Updated by stbuehler almost 2 years ago

  • Target version changed from 1.4.39 to 1.4.40
#7

Updated by stbuehler almost 2 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100

Applied in changeset r3070.

#8

Updated by stbuehler almost 2 years ago

  • Has duplicate Bug #2421: lighttpd 1.4.31 is not compatible with lua 5.2.1 added

Also available in: Atom