From b309d4fdcc51a133bdce76b602e9f7489d2531a0 Mon Sep 17 00:00:00 2001 From: binarycat Date: Mon, 11 Mar 2024 10:55:46 -0400 Subject: [PATCH] lua: actually fix longstanding bug in lua envHook causing relative module imports to stop working somehow, between all my testing, all the code review, and my code being copy-pasted into other people's PRs, noone noticed the glaring issue in the singular line of code i committed. there was a missing negation. this has now been fixed. --- pkgs/development/interpreters/lua-5/hooks/setup-hook.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh b/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh index 1c445b82afde..7b2d2a4d83d8 100644 --- a/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh +++ b/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh @@ -22,6 +22,11 @@ addToLuaSearchPathWithCustomDelimiter() { # export only if we haven't already got this dir in the search path if [[ ${!varName-} == *"$absPattern"* ]]; then return; fi + # if the path variable has not yet been set, initialize it to ";;" + # this is a magic value that will be replaced by the default, + # allowing relative modules to be used even when there are system modules. + if [[ ! -v "${varName}" ]]; then export "${varName}=;;"; fi + export "${varName}=${!varName:+${!varName};}${absPattern}" }