BUG/MINOR: hlua: take default-path into account with lua-load-per-thread
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 28 Jul 2025 18:14:53 +0000 (20:14 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 13:41:49 +0000 (15:41 +0200)
commit5f777b1a09a69e0466074d7eb8dd18b1e497cb39
tree8f0ac21a63c506151ce1fecc1c3f3ff4586dc998
parent9cb262b80203d4b250efc8165e66857d08c8b242
BUG/MINOR: hlua: take default-path into account with lua-load-per-thread

As discussed in GH #3051, default-path is not taken into account when
loading files using lua-load-per-thread. In fact, the initial
hlua_load_state() (performed on first thread which parses the config)
is successful, but other threads run hlua_load_state() later based
on config hints which were saved by the first thread, and those config
hints only contain the file path provided on the lua-load-per-thread
config line, not the absolute one. Indeed, `default-path` directive
changes the current working directory only for the thread parsing the
configuration.

To fix the issue, when storing config hints under hlua_load_per_thread()
we now make sure to save the absolute file path for `lua-load-per-thread'
argument.

Thanks to GH user @zhanhb for having reported the issue

It may be backported to all stable versions.

(cherry picked from commit 2ffe515d97a80318f1f3a84f8e18015500b8ef01)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit ac1be87c8359abad1c1a55f5ea6822d4362706db)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 0ea8c5bd38ef8b85f7efaa2ae3e4543127bee4e4)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/hlua.c