[tex-live] Advice on debugging segfault in luatex (2017 source, gcc-7.1) ?

Dr. Werner Fink werner at suse.de
Thu Jun 1 12:43:23 CEST 2017


On Mon, May 22, 2017 at 01:37:39AM +0100, Ken Moffat wrote:
> OK, I came late to this - I'm behind on everything and my "distro"
> of choice (LFS) has moved to gcc-7.1.  First I installed the
> x86_64-linux binary: works, although I was surprised to see that asy
> now needs libtinfo.so.5 (libncurses.so.5 used to be fine - a post on
> an Arch formum suggested symlinking to that, which seems to fix it).
> 
> IFF I can build from source, I may have further comments on asy : my
> 3D document seemed to build extremely slowly.  But meanwhile -
> 
> With source from r44437 I'm getting one test failure in 'make check':
> FAIL: luatexdir/luaimage.test
> 
> And when I look in my build dir (texlive-build/ since there is
> already a Build/) at texk/web2c/test-suite.log I see bad news:
> 
> line 12:   5909 Segmentation fault   ./luatex -ini luaimage
> 
> So, I'm fairly sure this is a gcc-7.1 problem.  I've installed gdb,
> and added -g to my CFLAGS and CXXFLAGS, but I'm having trouble
> trying to run that command by hand (so that I know I have the
> *right* command before I invoke gdb).
> 
> I went into my texlive-build/texk/web2c directory and tried to run
> ./luatex -ini ../../../texk/web2c/luatexdir/tests/luaimage.tex
> (note in passing that the luatex wrapper is very hard to exit if it
> can't find the specified file)
> 
> But that just gives me:
> ! I can't find file `basic'.
> l.5   \input basic
> 
> At least ^D works there, but can somebody give me hints about how to
> run this test / where to run it from, please ?

I'm using a simple patch to avoid this crash.  The problem is that
gcc-7.1 *does* align if specified but lua52 lua_touserdata() does
not return an aligned type at all.

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
-------------- next part --------------
---
 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
       ;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 880 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-live/attachments/20170601/a5df6f62/attachment.sig>


More information about the tex-live mailing list