From 08805e977d28e238babbdb3b041b06e704cb059a Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 27 Feb 2018 11:10:19 -0600 Subject: [PATCH 1/2] texlive: patch luatex to fix crash w/gcc7 Fixes #35839. --- pkgs/tools/typesetting/tex/texlive/bin.nix | 2 ++ .../typesetting/tex/texlive/luatex-gcc7.patch | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix index 44c2dc16317..f022ccb829a 100644 --- a/pkgs/tools/typesetting/tex/texlive/bin.nix +++ b/pkgs/tools/typesetting/tex/texlive/bin.nix @@ -168,6 +168,8 @@ core-big = stdenv.mkDerivation { #TODO: upmendex # http://tex.stackexchange.com/questions/97999/when-to-use-luajittex-in-favour-of-luatex ]; + patches = [ ./luatex-gcc7.patch ]; + configureScript = ":"; # we use static libtexlua, because it's only used by a single binary diff --git a/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch b/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch new file mode 100644 index 00000000000..4535d98de3b --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch @@ -0,0 +1,30 @@ +https://www.tug.org/pipermail/tex-live/2017-June/040192.html +--- + texk/web2c/luatexdir/luaffi/ctype.c | 4 ++++ + texk/web2c/luatexdir/luaffi/ffi.h | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- texk/web2c/luatexdir/luaffi/ctype.c ++++ texk/web2c/luatexdir/luaffi/ctype.c 2017-05-31 13:08:25.421741873 +0000 +@@ -245,6 +245,10 @@ void* to_cdata(lua_State* L, int idx, st + + lua_pop(L, 1); /* mt */ + cd = (struct cdata*) lua_touserdata(L, idx); ++ if (!cd) { ++ lua_pushnil(L); ++ return NULL; ++ } + *ct = cd->type; + lua_getuservalue(L, idx); + +--- texk/web2c/luatexdir/luaffi/ffi.h ++++ texk/web2c/luatexdir/luaffi/ffi.h 2017-06-01 09:12:45.128442092 +0000 +@@ -370,7 +370,7 @@ __declspec(align(16)) + #endif + struct cdata { + const struct ctype type +-#ifdef __GNUC__ ++#if 0 /* def __GNUC__ */ + __attribute__ ((aligned(16))) + #endif + ; From af73962f4506ca8070d986f40cca0ab8c301a518 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Tue, 27 Feb 2018 11:13:45 -0600 Subject: [PATCH 2/2] luatex: add prefix to patch so it applies with default patch flags --- pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch b/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch index 4535d98de3b..cdaa968bd42 100644 --- a/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch +++ b/pkgs/tools/typesetting/tex/texlive/luatex-gcc7.patch @@ -4,8 +4,8 @@ https://www.tug.org/pipermail/tex-live/2017-June/040192.html texk/web2c/luatexdir/luaffi/ffi.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) ---- texk/web2c/luatexdir/luaffi/ctype.c -+++ texk/web2c/luatexdir/luaffi/ctype.c 2017-05-31 13:08:25.421741873 +0000 +--- a/texk/web2c/luatexdir/luaffi/ctype.c ++++ b/texk/web2c/luatexdir/luaffi/ctype.c 2017-05-31 13:08:25.421741873 +0000 @@ -245,6 +245,10 @@ void* to_cdata(lua_State* L, int idx, st lua_pop(L, 1); /* mt */ @@ -17,8 +17,8 @@ https://www.tug.org/pipermail/tex-live/2017-June/040192.html *ct = cd->type; lua_getuservalue(L, idx); ---- texk/web2c/luatexdir/luaffi/ffi.h -+++ texk/web2c/luatexdir/luaffi/ffi.h 2017-06-01 09:12:45.128442092 +0000 +--- a/texk/web2c/luatexdir/luaffi/ffi.h ++++ b/texk/web2c/luatexdir/luaffi/ffi.h 2017-06-01 09:12:45.128442092 +0000 @@ -370,7 +370,7 @@ __declspec(align(16)) #endif struct cdata {