rrthomas / lrexlib

A Lua (5.1 and later) binding of various regex library APIs (POSIX, PCRE, PCRE2, GNU, Oniguruma and TRE)
Other
161 stars 29 forks source link

LuaJIT with lrexlib #13

Closed myraid closed 9 years ago

myraid commented 9 years ago

I wanted to use lrexlib with LuaJIT 2.0.3 and could not get it to work. It segfaults. The same luascript works with lua 5.1.

0 lj_alloc_malloc (msp=0x40000378, nsize=) at lj_alloc.c:1191

1 0x00007ffff71a5baa in Lmalloc () from ./rex_pcre.so

2 0x00007ffff71a6682 in compile_regex () from ./rex_pcre.so

3 0x00007ffff71a8043 in generic_find_func () from ./rex_pcre.so

4 0x000000000041b718 in lj_BC_FUNCC ()

5 0x0000000000409b20 in lua_pcall (L=, nargs=, nresults=, errfunc=)

at lj_api.c:1052
shmuz commented 9 years ago
myraid commented 9 years ago

lrexlib2.7.1 built using luarocks. I am trying to use pcre. RHEL 6.5 here is the testcase. local regex = require 'rex_pcre'

function test() local str = 'bcd' if(regex.find(str, '^(abc|abcd|bcd|acd)') ~= nil) then print('match found ') else print('no match found') end end

test()

shmuz commented 9 years ago

Please try Lrexlib 2.7.2. There was an important fix there related to memory allocation.

myraid commented 9 years ago

I tried and it works. Thanks for the quick response.