From 1e184f14af5deb5c53ea99d5b4d51c44be483705 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 12 Nov 2023 15:55:55 +0100 Subject: [PATCH] core extensions: fix: don't redefine extension_function_info when recursing - otherwise when there's a chain of enable_extension() we lose the original info --- lib/functions/general/extensions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/functions/general/extensions.sh b/lib/functions/general/extensions.sh index ad8270ae9..da28c135d 100644 --- a/lib/functions/general/extensions.sh +++ b/lib/functions/general/extensions.sh @@ -505,7 +505,9 @@ function enable_extension() { # iterate over defined functions, store them in global associative array extension_function_info for newly_defined_function in ${new_function_list}; do - #echo "func: ${newly_defined_function} has DIR: ${extension_dir}" + # Check if "${newly_defined_function}" is already defined in the extension_function_info array, if not, add it + # This is to address the recursive case messing up references + [[ -v extension_function_info["${newly_defined_function}"] ]] && continue extension_function_info["${newly_defined_function}"]="EXTENSION=\"${extension_name}\" EXTENSION_DIR=\"${extension_dir}\" EXTENSION_FILE=\"${extension_file}\" EXTENSION_ADDED_BY=\"${stacktrace}\"" done