tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Lua shared object asymmetry loading Xlib.




> Am 04.01.2019 um 19:29 schrieb Valery Ushakov <uwe%stderr.spb.ru@localhost>:
> 
> On Wed, Dec 26, 2018 at 09:44:53 -0900, Phil Rulon wrote:
> 
>> msd$ /usr/bin/lua -v test.lua
>> Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
>> table
>> function
>> [1]   Segmentation fault (core dumped) /usr/bin/lua -v test.lua
>> 
>> msd$ gdb -q /usr/bin/lua lua.core
>> Reading symbols from /usr/bin/lua...(no debugging symbols found)...done.
>> [New process 1]
>> Core was generated by `lua'.
>> Program terminated with signal SIGSEGV, Segmentation fault.
>> #0  0x00007f7ff5001458 in ?? ()
>> (gdb) where
>> #0  0x00007f7ff5001458 in ?? ()
>> #1  0x00007f7ff64f3d69 in __cxa_finalize () from /usr/lib/libc.so.12
>> #2  0x00007f7ff64f3a4a in exit () from /usr/lib/libc.so.12
>> #3  0x000000000040176c in ___start ()
> 
> This is because atexit and dlopen don't mix too well:
> 
> #0  0x00007f7ff68f1388 in atexit () from /usr/lib/libc.so.12
> #1  0x00007f7ff540147d in XauFileName () from /usr/X11R7/lib/libXau.so.7
> #2  0x00007f7ff54010b7 in XauGetBestAuthByAddr ()
>   from /usr/X11R7/lib/libXau.so.7
> #3  0x00007f7ff5c0bd5b in ?? () from /usr/X11R7/lib/libxcb.so.2
> #4  0x00007f7ff5c0bf0d in _xcb_get_auth_info () from /usr/X11R7/lib/libxcb.so.2
> #5  0x00007f7ff5c0bb8e in xcb_connect_to_display_with_auth_info ()
>   from /usr/X11R7/lib/libxcb.so.2
> #6  0x00007f7ff606323d in _XConnectXCB () from /usr/X11R7/lib/libX11.so.7
> #7  0x00007f7ff6061f81 in XOpenDisplay () from /usr/X11R7/lib/libX11.so.7
> #8  0x00007f7ff6400692 in open_display (L=0x7f7ff7b01808) at Xlib.c:8
> 
> 
> When atexit handlers are run when main returns the dlclose has already
> yanked the function that was registered to run.  With explicit
> os.exit() the exit happens while the libs are still loaded, so it
> works ok.

Why are atexit handlers run after dlclosing loaded libraries?  That sounds wrong to me, but is there a reason?

> 
> 
>> msd$ /usr/pkg/bin/lua5.3 -v test.lua
>> Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>> boolean
>> /usr/pkg/bin/lua5.3: test.lua:4: attempt to index a boolean value (local
>> 'Xlib')
>> stack traceback:
>>        test.lua:4: in main chunk
>>        [C]: in ?
> 
> I can't reproduce this second problem on current.
> 
> -uwe



Home | Main Index | Thread Index | Old Index