Add the _RELEASE global variable to get the Lua release version number

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Add the _RELEASE global variable to get the Lua release version number

Yegappan Lakshmanan
Hi,

Some of the lua error messages are different between the 5.4.2 and the
5.4.3 releases. This breaks the Vim lua tests (as it checks for specific
lua error messages) as reported in the following bug report:





The Vim lua test script uses the _VERSION variable to get the Lua version
and checks for specific error messages based on the Lua version.
But this variable contains only the major and minor Lua version numbers.
So this check fails to differentiate between the 5.4.2 and the 5.4.3 versions.

Running the "lua -v" command displays the major, minor and release version
numbers. But using this command from the Vim test script may give the
incorrect Lua version number, because the lua version in the PATH may
be different from the Lua version Vim is linked against or in some cases
the Lua executable may not be present in the PATH.

To address this correctly, we will need to add a new global variable 
called _RELEASE that contains the major, minor and the release 
version numbers.

I am attaching a patch to add this global variable.

Regards,
Yegappan


lua_release.diff (900 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Add the _RELEASE global variable to get the Lua release version number

Roberto Ierusalimschy
> Some of the lua error messages are different between the 5.4.2 and the5.4.3 releases. This breaks the Vim lua tests (as it checks for specificlua error messages) as reported in the following bug report:
> Some lua tests fail with lua 5.4 · Issue #8042 · vim/vim
> [...]

Thanks for the report. Can you describe what messages have changed?

-- Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Add the _RELEASE global variable to get the Lua release version number

Yegappan Lakshmanan
Hi,

>
> On Tuesday, April 6, 2021, 02:23:28 PM PDT, Roberto Ierusalimschy
> <[hidden email]> wrote:
> > Some of the lua error messages are different between the 5.4.2 and
> > the5.4.3 releases. This breaks the Vim lua tests (as it checks for
> > specificlua error messages) as reported in the following bug report:
> > Some lua tests fail with lua 5.4 · Issue #8042 · vim/vim
> > [...]
> Thanks for the report. Can you describe what messages have changed?
>
> -- Roberto

The following messages are changed between Lua 5.4.2 and 5.4.3:

5.4.2:
[string \"vim chunk\"]:1: attempt to call a nil value (global 'func')

5.4.3:
[string \"vim chunk\"]:1: global 'func' is not callable (a nil value)

5.4.2:
[string \"luaeval\"]:1: attempt to call a nil value (field 'xyz')

5.4.3:
[string \"luaeval\"]:1: field 'xyz' is not callable (a nil value)

5.4.2:
[string \"vim chunk\"]:1: attempt to call a nil value (method 'xyz')

5.4.3:
[string \"vim chunk\"]:1: method 'xyz' is not callable (a nil value)

- Yegappan


Reply | Threaded
Open this post in threaded view
|

Re: Add the _RELEASE global variable to get the Lua release version number

Roberto Ierusalimschy
> The following messages are changed between Lua 5.4.2 and 5.4.3:
> 5.4.2:[string \"vim chunk\"]:1: attempt to call a nil value (global 'func')
> 5.4.3:[string \"vim chunk\"]:1: global 'func' is not callable (a nil value)
> 5.4.2:[string \"luaeval\"]:1: attempt to call a nil value (field 'xyz')
> 5.4.3:[string \"luaeval\"]:1: field 'xyz' is not callable (a nil value)
> 5.4.2:[string \"vim chunk\"]:1: attempt to call a nil value (method 'xyz')
> 5.4.3:[string \"vim chunk\"]:1: method 'xyz' is not callable (a nil value)

Thanks. That change was unfortunate; we will revert to the old messages,
which are consistent with other similar messages.

For now, you can use the following code to test the release :-)

function isrelease5_4_3 ()
  local stat, msg = pcall(function () goo() end)
  return string.find(msg, "callable") and true or false
end

-- Roberto