openresty / openresty/lua-resty-shell

Cannot be run in Resty CLI

Open
#11 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Raku
Stars
133
Forks
19
Avg merge
2h 31m
Merged PRs (30d)
1

Description

I use resty to run unit tests against an openresty project, but any files which require this shell module will fail with this message:

Error → /usr/local/openresty/lualib/ngx/pipe.lua @ 500
suite ./spec/util_spec.lua
/usr/local/openresty/lualib/ngx/pipe.lua:500: cannot change a protected metatable

stack traceback:
	/usr/local/openresty/lualib/ngx/pipe.lua:500: in main chunk

The fact that this is a test doesn't matter, even a simple require will crash the script. The trace points to this line:

local Proc = ffi.metatype("ngx_http_lua_ffi_pipe_proc_t", mt)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ngx/pipe.lua at line 500 and reproduce the failure by requiring the module through Resty CLI, using the stack trace in the issue as the reference. Investigate why ffi.metatype rejects the protected metatable in that environment; done means a simple require and the reported unit-test use no longer crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.