lua under FreeBSD

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

lua under FreeBSD

Max Ischenko
Has anyone positive experience of using Lua under FreeBSD?

I develop multithread application that using Lua which works fine on Linux
and dumps core on FreeBSD.

Env:
FreeBSD v4.2 with pthreads library
Lua 4.0

while executing 
	lua_register(_lua, name.c_str(), fn);

program receives SIGBUS
and while executing
	lua_dostring(_lua, "_OUTPUT=_STDERR");
program receives SIGSEGV.

Any ideas why is it so?

-- 
The "cutting edge" is getting rather dull.
		-- Andy Purshottam

Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Luiz Henrique de Figueiredo
>Has anyone positive experience of using Lua under FreeBSD?

We don't have access to a FreeBSD machine, but Lua has been in the FreeBSD
list for a while now, so I assume that would be not problems running Lua in
FreeBSD. See http://www.freebsd.org/ports/lang.html

>I develop multithread application that using Lua which works fine on Linux
>and dumps core on FreeBSD.
>
>Env:
>FreeBSD v4.2 with pthreads library
>Lua 4.0

Is it just Lua 4.0? Does 3.2 work fine?
Do the distribution tests of both versions run ok?
Does it have to do with the pthreads library?

>while executing 
>	lua_register(_lua, name.c_str(), fn);
>
>program receives SIGBUS
>and while executing
>	lua_dostring(_lua, "_OUTPUT=_STDERR");
>program receives SIGSEGV.
>
>Any ideas why is it so?

Can you give us a stack traceback as printed by gdb?
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Max Ischenko
	Hi there, Luiz Henrique de Figueiredo!
	On Thursday, 21 of December you wrote:

> >Has anyone positive experience of using Lua under FreeBSD?
> 
> We don't have access to a FreeBSD machine, but Lua has been in the FreeBSD
> list for a while now, so I assume that would be not problems running Lua in
> FreeBSD. See http://www.freebsd.org/ports/lang.html

Problem has been solved.
Mysterious crashes were caused by another library. ;-)

-- 
Best regards, Maxim F. Ischenko.

Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Max Ischenko
> 
> 	Hi there, Luiz Henrique de Figueiredo!
> 	On Thursday, 21 of December you wrote:
> 
> > >Has anyone positive experience of using Lua under FreeBSD?
> > 
> > We don't have access to a FreeBSD machine, but Lua has been in the FreeBSD
> > list for a while now, so I assume that would be not problems running Lua in
> > FreeBSD. See http://www.freebsd.org/ports/lang.html
> 
> Problem has been solved.
> Mysterious crashes were caused by another library. ;-)

BTW, FreeBSD linker gives this warning:

../../foobar/libLualib.a(liolib.o): In function `io_tmpname':
liolib.o(.text+0xd5f): warning: tmpnam() possibly used unsafely; consider
using mkstemp()


I think this can be interesting for Lua developers...

-- 
Best regards, Maxim F. Ischenko.

Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Brian Mitchell-2
Yes, thats because lua exports tmpname(). It does not make use of it
though. It's no more dangerous than libc containing the same function,
although its use can be dangerous if any of your lua scripts use it.



On Fri, 22 Dec 2000, Max Ischenko wrote:

> 
> > 
> > 	Hi there, Luiz Henrique de Figueiredo!
> > 	On Thursday, 21 of December you wrote:
> > 
> > > >Has anyone positive experience of using Lua under FreeBSD?
> > > 
> > > We don't have access to a FreeBSD machine, but Lua has been in the FreeBSD
> > > list for a while now, so I assume that would be not problems running Lua in
> > > FreeBSD. See http://www.freebsd.org/ports/lang.html
> > 
> > Problem has been solved.
> > Mysterious crashes were caused by another library. ;-)
> 
> BTW, FreeBSD linker gives this warning:
> 
> ../../foobar/libLualib.a(liolib.o): In function `io_tmpname':
> liolib.o(.text+0xd5f): warning: tmpnam() possibly used unsafely; consider
> using mkstemp()
> 
> 
> I think this can be interesting for Lua developers...
> 
> -- 
> Best regards, Maxim F. Ischenko.
> 


Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Bret Mogilefsky-4
The difference is that clients linking to libc will get the warning not to
use it, but scripts written in Lua won't.  I realize straight ANSI C
portability is one of Lua's goals, but it would be very nice if Lua did the
right thing automatically by preventing someone from writing a script that
makes insecure use of /tmp...  Either by using mkstemp() where available,
or at least by putting out the same warning when someone calls tmpnam().

Bret

On Fri, Dec 22, 2000 at 09:52:25AM -0500, Brian Mitchell wrote:
> Yes, thats because lua exports tmpname(). It does not make use of it
> though. It's no more dangerous than libc containing the same function,
> although its use can be dangerous if any of your lua scripts use it.
> 
> On Fri, 22 Dec 2000, Max Ischenko wrote:
> > BTW, FreeBSD linker gives this warning:
> > 
> > ../../foobar/libLualib.a(liolib.o): In function `io_tmpname':
> > liolib.o(.text+0xd5f): warning: tmpnam() possibly used unsafely; consider
> > using mkstemp()
> > 
> > 
> > I think this can be interesting for Lua developers...


-- 
Bret Mogilefsky  ** [hidden email] **  Programmer, SCEA R&D

Reply | Threaded
Open this post in threaded view
|

Re: lua under FreeBSD

Christian Vogler-3
> The difference is that clients linking to libc will get the warning not to
> use it, but scripts written in Lua won't.  I realize straight ANSI C
> portability is one of Lua's goals, but it would be very nice if Lua did the
> right thing automatically by preventing someone from writing a script that
> makes insecure use of /tmp...  Either by using mkstemp() where available,
> or at least by putting out the same warning when someone calls tmpnam().

IIRC from looking at the glibc source code, on Linux tmpnam() is
reasonably safe, because when available it uses /dev/urandom to
generate the file name. But I agree, in general it is dangerous and at
least a warning would be nice.

- Christian