]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0154: if_lua: runtime error with lua 5.5 v9.2.0154
authorChristian Brabandt <cb@256bit.org>
Fri, 13 Mar 2026 19:21:43 +0000 (19:21 +0000)
committerChristian Brabandt <cb@256bit.org>
Fri, 13 Mar 2026 19:26:05 +0000 (19:26 +0000)
Problem:  Lua 5.5 makes for-loop control variables read-only.
          The path-parsing logic in if_lua.c attempts to modify the
          loop variable 's', causing the script to fail during
          runtime initialization (Binbin Qian)
Solution: Use a Lua capture group in gmatch() to extract the path
          without the semicolon, avoiding the need to re-assign
          to the loop variable.

fixes:  #19639
closes: #19658

supported by AI

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/if_lua.c
src/version.c

index 36425616177546cee583ea4cd5d3e5a79bd9d053..7321af268097cd6015b28791204039f887873a79 100644 (file)
@@ -2431,8 +2431,7 @@ luaV_pushversion(lua_State *L)
     "    -- Note: ignores trailing item without trailing `;`. Not using something\n"\
     "    -- simpler in order to preserve empty items (stand for default path).\n"\
     "    local orig = {}\n"\
-    "    for s in orig_str:gmatch('[^;]*;') do\n"\
-    "      s = s:sub(1, -2)  -- Strip trailing semicolon\n"\
+    "    for s in orig_str:gmatch('([^;]*);') do\n"\
     "      orig[#orig + 1] = s\n"\
     "    end\n"\
     "    if key == 'path' then\n"\
index 184a7d327f6c629f0ece2a266d74d8d5a4d0a3d4..ae999c903b858f96ebba40f12e13b97ca7822c31 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    154,
 /**/
     153,
 /**/