Repository navigation
[2.4.x] Merge changes to mod_lua: LuaHook sections under 5.5, LuaHook + package path - #1041
Merged
Merged
Conversation
mod_lua: fix LuaScope server with inline blocks and .htaccess paths (apache#1030) copy_vm_spec() copies the VM spec into the process pool for the server-scoped VM reslist, but copied the compiled bytecode of a <LuaHook...> block with apr_pstrdup(), truncating it at the first NUL byte of the Lua header while keeping the full length. The hook function was never defined and every request failed with "Unable to find entry function". Use apr_pmemdup() with the length. The package path arrays were copied with apr_array_copy(), which only copies the pointers, so with LuaPackagePath or LuaPackageCPath set in .htaccess the strings lived in a request pool and were dangling when the reslist constructed a further VM later. Deep-copy the strings. While adding a test for this, the <LuaHook...> block reader crashed at config time when built against Lua 5.5: lua_dump() now pushes a table on the stack while dumping, and the luaL_Buffer used by the writer assumes its own box is at the stack top. Accumulate the bytecode in an ap_varbuf instead, off the Lua stack. Add a test/modules/lua pytest suite with a test that fails on the bytecode copy before this change. Its conftest.py and env.py match the suite proposed in PR apache#1022 so the two merge cleanly in either order. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> (cherry picked from commit c774272)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge c774272 from trunk:
The pick conflicted only on the include block at the top of
modules/lua/mod_lua.c, where 2.4.x has an extra Windowsgetpidinclude; the code hunks are identical to trunk. Thetest/modules/luasuite does not exist on 2.4.x yet, so the pick adds the four files from this commit unchanged.🤖 Generated with Claude Code