summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-04-21 09:50:46 -0400
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2026-04-21 14:18:27 +0000
commit26bcffda6c8177776852946cb1afa08b6e247343 (patch)
tree7ea086a25ec4cbe57899da6c6a443f48b9e3d13f
parentffb0ebb752ba2aeb862cbe990823c55306bb4c94 (diff)
build: gen_char_blob.lua: "bad argument to format" if path contains "%" #39274
Problem: Build fails if user cloned the repo to a path with "%" chars: src/gen/gen_char_blob.lua:51: bad argument #1 to 'format' (number expected, got string) Solution: - Escape "%" chars. - Also use "%q" in case the path has spaces... (cherry picked from commit 4af0c5d8df5d72af28c171007d35e4e6285a0f57)
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d7d410a44..c798772b37 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -211,14 +211,18 @@ if(COMPILE_LUA AND NOT WIN32)
foreach(CURRENT_LUAC_PRG luac5.1 luac)
find_program(_CHECK_LUAC_PRG ${CURRENT_LUAC_PRG})
if(_CHECK_LUAC_PRG)
- set(LUAC_PRG "${_CHECK_LUAC_PRG} -s -o - %s" CACHE STRING "Format for compiling to Lua bytecode")
+ # Escape "%" for string.format() (in gen_char_blob.lua). #39271
+ string(REPLACE "%" "%%" _LUAC_PRG_ESCAPED "${_CHECK_LUAC_PRG}")
+ set(LUAC_PRG "${_LUAC_PRG_ESCAPED} -s -o - %q" CACHE STRING "Format for compiling to Lua bytecode")
break()
endif()
endforeach()
elseif(LUA_PRG MATCHES "luajit")
check_lua_module(${LUA_PRG} "jit.bcsave" LUAJIT_HAS_JIT_BCSAVE)
if(LUAJIT_HAS_JIT_BCSAVE)
- set(LUAC_PRG "${LUA_PRG} -b -s %s -" CACHE STRING "Format for compiling to Lua bytecode")
+ # Escape "%" for string.format() (in gen_char_blob.lua). #39271
+ string(REPLACE "%" "%%" _LUA_PRG_ESCAPED "${LUA_PRG}")
+ set(LUAC_PRG "${_LUA_PRG_ESCAPED} -b -s %q -" CACHE STRING "Format for compiling to Lua bytecode")
endif()
endif()
endif()