Skip to contentSkip to conversation

toolchain-scripts: compatibility with unbound variable protection

PATCH In review [email protected] 1 participant 2 messages Jan 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain-scripts: compatibility with unbound variable protection

From: Jan Kircher <[email protected]>

Fixed an error when Bash's unbound variable protection is enabled (set -u) and variable "LD_LIBRARY_PATH" does not exist.

---
 meta/classes-recipe/toolchain-scripts.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/toolchain-scripts.bbclass +1 -1
index 3cc823fe63..fa658a6596 100644
@@ -37,7 +37,7 @@ toolchain_create_sdk_env_script () {
 	echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script
 	echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script
 	echo '# Only disable this check if you are absolutely know what you are doing!' >> $script
-	echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script
+	echo 'if [ ! -z "${LD_LIBRARY_PATH:-}" ]; then' >> $script
 	echo "    echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script
 	echo "    echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script
 	echo '    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script
Signature · 1 line
2.39.0
#1 lore raw

This also applies to langdale and kirkstone. Kirkstone has this class in meta/classes/toolchain-scripts.bbclass.