[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: io.popen binary write compatibility
- From: William Ahern <william@...>
- Date: Wed, 24 Sep 2014 17:45:25 -0700
On Wed, Sep 24, 2014 at 08:51:02PM -0300, Roberto Ierusalimschy wrote:
> > I may have noted a slight portability problem in io.popen.
>
> The manual states that this command is system-dependent... (And why are
> you using binary data anyway? :)
>
Which reminds me.
The internal routines lua_checkmode and l_checkmode, in Lua 5.2 and 5.3
respectively, only permit the characters [rwab+]. However, C11 added the "x"
flag, which in Unix maps to O_EXCL. This is a rather important security
feature necessary to avoid some TOCTTOU bugs, and it's bothersome that it's
impossible to use it from stock Lua, even where the platform supports it.
I know that Lua's touchstone is C89, and I think this type of issue
discussed was before and it was mentioned that the existing behavior is
preferable to passing through platform-specific flags. But I don't think it
involved the "x" flag in particular, which has a uniquely important purpose.