Merge #295012: lua: actually fix longstanding bug in lua envHook

..causing relative module imports to stop working.
Merge into staging
This commit is contained in:
Vladimír Čunát 2024-03-12 08:24:45 +01:00
commit d6cd575b84
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -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}"
}