openresty / openresty/lua-resty-shell

invalid value (nil) at index 285 in table for 'concat'

Open
#19 7 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

error:

 [error] 6280#6280: *962711 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/shell.lua:136: invalid value (nil) at index 2 in table for 'concat'
stack traceback:
coroutine 0:
        [C]: in function 'concat'
        /usr/local/openresty/lualib/resty/shell.lua:139: in function 'run'

code:

        local shell = require "resty.shell"

        local stdin = nil
        local timeout = 10000  -- ms
        local max_size = 40960  -- byte

        local ok, stdout, stderr, reason, status =
            shell.run([[curl https://blockchain.info/q/getreceivedbyaddress/123]], stdin, timeout, max_size)

since that is a error output(ok == nil) now I just edit the stdout and stderr to nil in shell.lua;

...
136         local stdout = nil
137         release_tab(tab_pool_tag, stdout_tab)
138
139         local stderr = nil
140         release_tab(tab_pool_tag, stderr_tab)
...

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 /usr/local/openresty/lualib/resty/shell.lua around lines 136-139 and reproduce the failure using shell.run with the curl command shown. Trace how error output is handled before table.concat; done means the command can return an error without triggering the nil-value concat runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.