Created attachment 159838 [details] www/lighttpd/Makefile update I changed options to new the use macros (except for those that don't have new macros yet). To make it work, I had to move setting options out of ".if !defined(_BUILDING_LIGHTTPD_MODULE)" (only those that were converted to the new schema). When it was in .if, setting them didn't work. I've checked that it configures lighttpd, so there's no regressions. I've also build-tested www/lighttpd-*, so there's no reggressions. The other change is that I've created patches for compatibility with Lua 5.2+. I've also build and run-tested them with Lua 5.2.
Take.
A commit references this bug: Author: pgollucci Date: Wed Aug 19 01:26:40 UTC 2015 New revision: 394667 URL: https://svnweb.freebsd.org/changeset/ports/394667 Log: www/lighttpd: modernize, support lua 5.2+ - Use USE OPTIONs helpers - add support for lua 5.2+ PR: 202302 Submitted by: pkubaj@riseup.net (maintainer) Changes: head/www/lighttpd/Makefile head/www/lighttpd/files/patch-src_mod__cml__lua.c head/www/lighttpd/files/patch-src_mod__magnet.c
A commit references this bug: Author: madpilot Date: Tue Sep 1 07:48:37 UTC 2015 New revision: 395750 URL: https://svnweb.freebsd.org/changeset/ports/395750 Log: MFH: r394667 www/lighttpd: modernize, support lua 5.2+ - Use USE OPTIONs helpers - add support for lua 5.2+ PR: 202302 Submitted by: pkubaj@riseup.net (maintainer) Needed to complete merge done in r395736. Approved by: ports-secteam (delphij) Changes: _U branches/2015Q3/ branches/2015Q3/www/lighttpd/Makefile branches/2015Q3/www/lighttpd/files/patch-src_mod__cml__lua.c branches/2015Q3/www/lighttpd/files/patch-src_mod__magnet.c
Hello, I don't know if this is related, but with recent update I am getting the following error upon lighttpd startup: /usr/local/lib/lighttpd/mod_magnet.so: Undefined symbol "lua_getfenv" 2015-09-24 11:42:51: (server.c.679) loading plugins finally failed ./lighttpd: WARNING: failed to start lighttpd Can you guys look at this please?
(In reply to Daniel Gerzo from comment #4) Please post your FreeBSD version, architecture and port options.
FreeBSD 10.1-STABLE #5 r284256M: Thu Jun 11 11:09:59 CEST 2015 amd64 root@[fw2-os /home/danger]# poudriere options -s -j 10x64 www/lighttpd [00:00:00] ====>> Appending to make.conf: /usr/local/etc/poudriere.d/make.conf [00:00:00] ====>> Appending to make.conf: /usr/local/etc/poudriere.d/10x64-make.conf ===> The following configuration options are available for lighttpd-1.4.37: BZIP2=off: bzip2 support (mod_compress) DOCS=on: Build and/or install documentation FAM=off: File Alteration Monitor support GDBM=off: gdbm storage (mod_trigger_b4_dl) IPV6=on: IPv6 protocol support LDAP=off: LDAP authentication LIBEV=off: High-performance events support via libev LUA=on: lua support (mod_cml, mod_magnet) MEMCACHE=off: memcached storage (mod_trigger_b4_dl) MYSQL=off: MySQL support (mod_mysql_vhost) MYSQLAUTH=off: MySQL authentication (requires WITH_MYSQL) NODELAY=on: Set TCP_NODELAY on listening sockets OPENSSL=on: SSL/TLS support via OpenSSL SPAWNFCGI=off: Depend on spawn-fcgi utility VALGRIND=off: valgrind support WEBDAV=off: WebDAV support ===> Use 'make config' to modify these settings ===> The following configuration options are available for lighttpd-1.4.37 and dependencies ===> The following configuration options are available for lighttpd-1.4.37: BZIP2=off: bzip2 support (mod_compress) DOCS=on: Build and/or install documentation FAM=off: File Alteration Monitor support GDBM=off: gdbm storage (mod_trigger_b4_dl) IPV6=on: IPv6 protocol support LDAP=off: LDAP authentication LIBEV=off: High-performance events support via libev LUA=on: lua support (mod_cml, mod_magnet) MEMCACHE=off: memcached storage (mod_trigger_b4_dl) MYSQL=off: MySQL support (mod_mysql_vhost) MYSQLAUTH=off: MySQL authentication (requires WITH_MYSQL) NODELAY=on: Set TCP_NODELAY on listening sockets OPENSSL=on: SSL/TLS support via OpenSSL SPAWNFCGI=off: Depend on spawn-fcgi utility VALGRIND=off: valgrind support WEBDAV=off: WebDAV support ===> Use 'make config' to modify these settings ===> The following configuration options are available for m4-1.4.17_1,1: EXAMPLES=on: Build and/or install examples LIBSIGSEGV=off: Use alternative page fault handler (GNU libsigsegv) ===> Use 'make config' to modify these settings ===> The following configuration options are available for help2man-1.43.3_1: NLS=on: Native Language Support ===> Use 'make config' to modify these settings ===> The following configuration options are available for gettext-tools-0.19.5.1: DOCS=on: Build and/or install documentation THREADS=on: Threading support ===> Use 'make config' to modify these settings ===> The following configuration options are available for libiconv-1.14_8: DOCS=on: Build and/or install documentation ENCODINGS=on: Include extra character sets PATCHES=on: Apply patches to fix CP932, add EUCJP-MS ===> Use 'make config' to modify these settings ===> The following configuration options are available for perl5-5.20.3_8: DEBUG=off: Build with debugging support GDBM=off: GDBM_File extension MULTIPLICITY=on: Use multiplicity PERL_64BITINT=on: Use 64 bit integers (on i386) PTHREAD=on: Build with -lpthread SITECUSTOMIZE=off: Run-time customization of @INC ====> Exclusive OPTIONS: you can only select none or one of them THREADS=on: Build threaded perl PERL_MALLOC=off: Use Perl malloc ===> Use 'make config' to modify these settings ===> The following configuration options are available for gmake-4.1_2: NLS=on: Native Language Support ===> Use 'make config' to modify these settings ===> The following configuration options are available for pcre-8.37_4: DOCS=on: Build and/or install documentation LIBEDIT=off: Command line editing via libedit READLINE=off: Command line editing via libreadline STACK_RECURSION=on: Use the stack for recursion during matching ===> Use 'make config' to modify these settings
(In reply to Daniel Gerzo from comment #6) I forgot to ask before, but do you use Lua 5.1 or 5.2? I'd like to know whether I'll have to correct my patch for Lua 5.2 (or maybe return to supporting only 5.1) or this is something with breaking compatibility with 5.1 (in which case I'll contact Lighttpd developers).
root@[web1-os /usr/local/etc]# pkg info -d lighttpd lighttpd-1.4.37: lua52-5.2.4 pcre-8.37_4
(In reply to Daniel Gerzo from comment #8) I can't reproduce this error when starting lighttpd. I've built it in poudriere with LUA on (it uses 5.2). It starts and runs correctly. Can you reproduce it when building in poudriere?
I am actually building my packages using poudriere. Do you have mod_magned enabled?
(In reply to Daniel Gerzo from comment #10) Yes, please take a look at: █▓▒░root@xxx█▓▒░ Mon Sep 28 02:21:16P ~/ pkg options lighttpd lighttpd - BZIP2: on lighttpd - DOCS: off lighttpd - FAM: off lighttpd - GDBM: off lighttpd - IPV6: on lighttpd - LDAP: off lighttpd - LIBEV: off lighttpd - LUA: on lighttpd - MEMCACHE: off lighttpd - MYSQL: off lighttpd - MYSQLAUTH: off lighttpd - NODELAY: off lighttpd - OPENSSL: on lighttpd - SPAWNFCGI: on lighttpd - VALGRIND: off lighttpd - WEBDAV: off █▓▒░root@xxx█▓▒░ Mon Sep 28 02:21:22P ~/ /usr/local/sbin/lighttpd -f /usr/local/etc/lighttpd/lighttpd.conf 2015-09-28 14:21:36: (network.c.283) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address; your config will break if the kernel default for IPV6_V6ONLY changes █▓▒░root@xxx█▓▒░ Mon Sep 28 02:21:36P ~/ sockstat -4 -l | grep www www lighttpd 86276 5 tcp4 *:80 *:* uname -a: FreeBSD xxx 10.2-RELEASE FreeBSD 10.2-RELEASE #13 r286769: Mon Aug 17 16:59:15 CEST 2015 toor@xxx:/usr/obj/usr/src/sys/xxx amd64
so I don't know what's going on....do you also have it enabled in lighttpd.conf or modules.conf (mod_magnet is not enabled by default)? root@[web1-os /usr/local/etc]# lighttpd -V lighttpd/1.4.37 (ssl) - a light and fast webserver Build-Date: Sep 24 2015 09:34:32 Event Handlers: + select (generic) + poll (Unix) - rt-signals (Linux 2.4+) - epoll (Linux 2.6) - /dev/poll (Solaris) - eventports (Solaris) + kqueue (FreeBSD) - libev (generic) Network handler: - linux-sendfile + freebsd-sendfile - solaris-sendfilev + writev + write - mmap support Features: + IPv6 support + zlib support - bzip2 support - crypt support + SSL Support + PCRE support - mySQL support - LDAP support - memcached support - FAM support + LUA support - xml support - SQLite support - GDBM support root@[web1-os /usr/local/etc]# ldd /usr/local/lib/lighttpd/mod_magnet.so /usr/local/lib/lighttpd/mod_magnet.so: liblua-5.2.so => /usr/local/lib/liblua-5.2.so (0x801606000) libm.so.5 => /lib/libm.so.5 (0x801839000) libc.so.7 => /lib/libc.so.7 (0x80081f000) libthr.so.3 => /lib/libthr.so.3 (0x801a61000)
(In reply to Daniel Gerzo from comment #12) You were right, mod_magnet was off. I have checked the 5.2 manual, and modfied src/mod_magned.c patch. Could you try this patch? For me it compiles and runs fine. Index: files/patch-src_mod__magnet.c =================================================================== --- files/patch-src_mod__magnet.c (revision 398075) +++ files/patch-src_mod__magnet.c (working copy) @@ -11,3 +11,31 @@ /* plugin config for all request/connections */ static jmp_buf exceptionjmp; +@@ -688,7 +688,7 @@ + * get the environment of the function + */ + +- lua_getfenv(L, -1); /* -1 is the function */ ++ lua_getuservalue(L, -1); /* -1 is the function */ + + /* lighty.header */ + +@@ -738,7 +738,7 @@ + */ + + force_assert(lua_isfunction(L, -1)); +- lua_getfenv(L, -1); /* -1 is the function */ ++ lua_getuservalue(L, -1); /* -1 is the function */ + + lua_getfield(L, -1, "lighty"); /* lighty.* from the env */ + force_assert(lua_istable(L, -1)); +@@ -988,7 +988,7 @@ + lua_setmetatable(L, -2); /* setmetatable({}, {__index = _G}) (sp -= 1) */ + + +- lua_setfenv(L, -2); /* on the stack should be a modified env (sp -= 1) */ ++ lua_setuservalue(L, -2); /* on the stack should be a modified env (sp -= 1) */ + + errfunc = push_traceback(L, 0); + if (lua_pcall(L, 0, 1, errfunc)) { +
(In reply to pkubaj from comment #13) If it works for you, I guess it can be committed, although PORTREVISION will need to be bumped.
OK, so with this patch lighttpd compiles fine and starts up fine as well, however the functionality of mod_magnet does not work. If we enable mod_magnet but do not set magnet.attract-physical-path-to, the server starts up and works fine, but when we set setting magnet.attract-physical-path-to = ( "/path/script.lua" ) and script.lua is non-empty the server returns 503.
(In reply to Daniel Gerzo from comment #15) I've opened the lighttpd bug based on what I got on IRC: http://redmine.lighttpd.net/issues/2674 In the following patch I remove the support for 5.2, set the port as 5.1-only. Since LUA is off by default, I didn't bump the PORTREVISION.
Created attachment 161523 [details] remove Lua 5.2+ support
Anyone using Lighttpd with Lua should try this patch (against master branch of Lighttpd): https://review.lighttpd.net/file/data/f7e2grz4jjiegmii5sjg/PHID-FILE-2xmht3cuvlx52rulqoe4/D4.diff You could also try lighttpd-1.4.x-stbuehler branch, which contains this patch.
It seems like Lighttpd 1.4.40 will support Lua 5.1+. If anyone wishes, I can backports this patch to 1.4.39: http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/3070/diff
Version 1.4.40 supports Lua 5.2+. I've submitted the patch to 1.4.40 at https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211163 so this PR can be closed.