diff options
author | Arnout Engelen <arnout@engelen.eu> | 2023-01-23 10:26:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 01:26:46 -0800 |
commit | cb757f2663e6950e655c6306d713338dfa66b18d (patch) | |
tree | 2919dcb164f5d6ce694d6a4055f9934e5a8cd529 /runtime/doc | |
parent | da671b21ccc289101ccf37c31dc739b153b41800 (diff) | |
download | rneovim-cb757f2663e6950e655c6306d713338dfa66b18d.tar.gz rneovim-cb757f2663e6950e655c6306d713338dfa66b18d.tar.bz2 rneovim-cb757f2663e6950e655c6306d713338dfa66b18d.zip |
build: make generated source files reproducible #21586
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).
https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671
https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.
Solution:
- Update the code generation scripts to be deterministic.
- That is only a partial solution: the exported function
(funcs_metadata.generated.h) and ui event
(ui_events_metadata.generated.h) metadata have some mpack'ed
tables, which are not serialized deterministically.
- As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
that preserves table order.
- Longer-term we should change the mpack'ed data structure so it no
longer uses tables keyed by strings.
Closes #20124
Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lua.txt | 12 | ||||
-rw-r--r-- | runtime/doc/news.txt | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 49b5c9da70..f325c58efb 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1694,6 +1694,18 @@ pesc({s}) *vim.pesc()* See also: ~ https://github.com/rxi/lume +spairs({t}) *vim.spairs()* + Enumerate a table sorted by its keys. + + Parameters: ~ + • {t} (table) List-like table + + Return: ~ + iterator over sorted keys and their values + + See also: ~ + Based on https://github.com/premake/premake-core/blob/master/src/base/table.lua + split({s}, {sep}, {kwargs}) *vim.split()* Splits a string at each instance of a separator. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 8a9736e1c2..83272a0d87 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -143,6 +143,10 @@ The following new APIs or features were added. instance in the background and display its UI on demand, which previously only was possible using an external UI implementation. +• Several improvements were made to make the code generation scripts more + deterministic, and a `LUA_GEN_PRG` build parameter has been introduced to + allow for a workaround for some remaining reproducibility problems. + ============================================================================== CHANGED FEATURES *news-changes* |