lua-users home
lua-l archive

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


>>>>> "Xmilia" == Xmilia Hermit <xmilia.hermit@gmail.com> writes:

 >>> You BROKE THE ABI with this version by adding a parameter to an
 >>> existing function (lua_resetthread).

 >> WHY was this second parameter added?

 Xmilia> It was added to fix the stack overflow that could be produced
 Xmilia> with lua_resetthread https://www.lua.org/bugs.html#5.4.4-9.

Yup. I believe this is analogous to the addition of a "from" parameter
to lua_resume between 5.1 and 5.2; but that was done at a major version
change, where the ABI and API are explicitly allowed to break.

The website explicitly states:

    Different releases of the same version correspond to bug fixes.
    Different releases of the same version have the same reference
    manual, the same virtual machine, and are binary compatible (ABI
    compatible).

    Different versions are really different. The API is likely to be a
    little different (but with compatibility switches), and there is no
    ABI compatibility: applications that embed Lua and C libraries for
    Lua must be recompiled. [...]

This release has just completely ignored this policy, breaking both the
API and ABI in a bugfix release. How are packagers and developers
supposed to understand the policy now? Do we have to assume the ABI
changes on every release and build accordingly?

A better fix would have been something like this: introduce a _new_
function lua_resetthread2 with the extra arg, use it internally in
coroutine.close() to prevent overflow happening in Lua code, and leave
lua_resetthread alone (perhaps documenting the possibility of stack
overflow from using it). Then in 5.5, change lua_resetthread to match.

-- 
Andrew.