about summary refs log tree commit diff
path: root/pkgs/development/interpreters/lua-5
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2024-03-11 10:55:46 -0400
committerbinarycat <binarycat@envs.net>2024-03-11 10:55:46 -0400
commitb309d4fdcc51a133bdce76b602e9f7489d2531a0 (patch)
treec201cbb422159232c5e43e9ac6fc50ea59ea49ca /pkgs/development/interpreters/lua-5
parent396306d5cea9bacfb2b03c7bfce23a8746c6f338 (diff)
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.
Diffstat (limited to 'pkgs/development/interpreters/lua-5')
-rw-r--r--pkgs/development/interpreters/lua-5/hooks/setup-hook.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh b/pkgs/development/interpreters/lua-5/hooks/setup-hook.sh
index 1c445b82afded..7b2d2a4d83d86 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}"
 }