aports/main/luajit/fix-tests-alpine.patch
Jakub Jirutka c12fb28e6d main/luajit: switch to OpenResty's maintained branch
The MoonJIT fork is unmaintained since September 2020 [1]:

> This code base does not have an active maintainer anymore, please
> read this [Twitter thread][2] to know more. If you are an existing
> contributor (or otherwise have an interest in maintaining this
> project actively) then please email me using the email address in
> my Twitter profile.

Moreover, the transition from original LuaJIT to MoonJIT caused multiple
compatibility and stability issues, mainly with Lua NGINX module
(#12410, #10478), but also with some Lua packages written in C (segfaults).

I wanted to switch back to the original (Mike's) LuaJIT, the latest revision
from the v2.1 branch. The problem is that it doesn't support ppc64le and
s390x. The existing patches don't apply anymore and I really don't have
enough knowledge and insanity in blood to update them. Dropping these
architectures would require updating many dependent aports which is not
a good idea at this moment (v3.14 will be released very soon).

OpenResty's "fork" seems to be the only active LuaJIT fork that regularly
synchronize changes from the upstream LuaJIT project and provides support
for all architectures we need.

> This is the official OpenResty branch of LuaJIT. It is not to be
> considered a fork, since we still regularly synchronize changes from the
> upstream LuaJIT project

Patches CVE-2020-15890 and 20-src-lib_string are already included in the
OpenResty's branch.

[1]: a2a39ea718:
[2]: https://twitter.com/siddhesh_p/status/1308594269502885889

Resolves #12410 #10478
2021-06-13 03:13:33 +02:00

89 lines
2.4 KiB
Diff

Fix tests to pass on musl and also avoid extra dependencies (e.g. ncurses, mpc, ...).
--- a/test-suite/run-tests
+++ b/test-suite/run-tests
@@ -73,14 +73,6 @@
$ENV{LUA_CPATH} = "$cwd/test/clib/?;;";
-my $cmd = "pkg-config --cflags --libs gtk+-2.0";
-my $cdefs = `$cmd`;
-if ($? != 0) {
- die "failed to run command $cmd: $?";
-}
-chomp $cdefs;
-$ENV{CDEFS} = $cdefs;
-
if (@ARGV) {
for my $test_file (@ARGV) {
my ($dir, $fname);
--- a/test-suite/test/ffi/ffi_redir.lua
+++ b/test-suite/test/ffi/ffi_redir.lua
@@ -12,7 +12,7 @@
]]
else
ffi.cdef[[
- int bar asm("errno");
+ int bar asm("opterr");
]]
end
--- a/test-suite/test/sysdep/ffi_include_gtk.lua
+++ b/test-suite/test/sysdep/ffi_include_gtk.lua
@@ -1,9 +0,0 @@
-local ffi = require("ffi")
-
-dofile("../common/ffi_util.inc")
-
-if cdefs == "" then
- cdefs = "-pthread -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gdk-pixbuf-2.0"
-end
-
-include"/usr/include/gtk-2.0/gtk/gtk.h"
--- a/test-suite/test/sysdep/ffi_include_std.lua
+++ b/test-suite/test/sysdep/ffi_include_std.lua
@@ -14,15 +14,8 @@
#define _Float128 long double
#include <sqlite3.h>
-#include <thread_db.h>
#include <resolv.h>
-#include <mpfr.h>
-#include <mpc.h>
-#include <curses.h>
-#include <form.h>
#include <aio.h>
-#include <unistd.h>
-#include <zlib.h>
#include <netdb.h>
#include <math.h>
#include <tgmath.h>
--- a/test-suite/test/sysdep/ffi_lib_c.lua
+++ b/test-suite/test/sysdep/ffi_lib_c.lua
@@ -7,6 +7,9 @@
int rmdir(const char *name);
int errno;
+// musl libc
+int *__errno_location(void);
+
// Windows
unsigned int GetSystemDirectoryA(char *buf, unsigned int sz);
char *CharUpperA(char *str);
@@ -62,11 +65,11 @@
ffi.C._fmode = ffi.C._O_TEXT
else
assert(ffi.C.rmdir("/tmp/does_not_exist") == -1)
- assert(ffi.C.errno == 2)
+ assert(ffi.C.__errno_location()[0] == 2)
- ffi.C.errno = 17
- assert(ffi.C.errno == 17)
- ffi.C.errno = 0
+ ffi.C.__errno_location()[0] = 17
+ assert(ffi.C.__errno_location()[0] == 17)
+ ffi.C.__errno_location()[0] = 0
end
do