From 12ab35b2cc822a2d8b50bf7c99b8136227de4de6 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Sat, 6 Jan 2024 00:25:55 -0500 Subject: [PATCH] Make sure variables based on $PWD are properly quoted This fixes https://github.com/libretro/docs/issues/889 --- libretro-build-common.sh | 8 ++++---- libretro-build-ios-arm64.sh | 2 +- libretro-build-tvos-arm64.sh | 2 +- script-modules/log.sh | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libretro-build-common.sh b/libretro-build-common.sh index cbe24739..88f6714f 100644 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -292,7 +292,7 @@ libretro_build_core() { if [ -n "${LIBRETRO_LOG_MODULE}" ]; then printf -v log_module "$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_MODULE" "$1" - [ -z "$LIBRETRO_LOG_APPEND" ] && : > $log_module + [ -z "$LIBRETRO_LOG_APPEND" ] && : > "$log_module" fi eval "core_name=\${libretro_${1}_name:-$1}" @@ -327,13 +327,13 @@ libretro_build_core() { lecho "Building ${1}..." if [ -n "$log_module" ]; then exec 6>&1 - echo "Building ${1}..." >> $log_module + echo "Building ${1}..." >> "$log_module" # TODO: Possibly a shell function for tee? if [[ -n "$LIBRETRO_DEVELOPER" && -n "${cmd_tee:=$(find_tool "tee")}" ]]; then - exec > >($cmd_tee -a $log_module) + exec > >($cmd_tee -a "$log_module") else - exec > $log_module + exec > "$log_module" fi fi diff --git a/libretro-build-ios-arm64.sh b/libretro-build-ios-arm64.sh index d72ecd70..4d1e3ad3 100755 --- a/libretro-build-ios-arm64.sh +++ b/libretro-build-ios-arm64.sh @@ -14,4 +14,4 @@ else fi fi -platform=ios-arm64 ${BASE_DIR}/libretro-build.sh $@ +platform=ios-arm64 "${BASE_DIR}/libretro-build.sh" $@ diff --git a/libretro-build-tvos-arm64.sh b/libretro-build-tvos-arm64.sh index a1fff4ec..3b95dec5 100755 --- a/libretro-build-tvos-arm64.sh +++ b/libretro-build-tvos-arm64.sh @@ -14,4 +14,4 @@ else fi fi -platform=tvos-arm64 ${BASE_DIR}/libretro-build.sh $@ +platform=tvos-arm64 "${BASE_DIR}/libretro-build.sh" $@ diff --git a/script-modules/log.sh b/script-modules/log.sh index 0b39b394..1c86fd7d 100644 --- a/script-modules/log.sh +++ b/script-modules/log.sh @@ -10,13 +10,13 @@ secho() { } lecho() { - [ -n "$LIBRETRO_LOG_SUPER" ] && echo "$@" >> $log_super + [ -n "$LIBRETRO_LOG_SUPER" ] && echo "$@" >> "$log_super" } lsecho() { echo "$@" [ -n "$log_file_only" ] && echo "$@" >&6 - [ -n "$LIBRETRO_LOG_SUPER" ] && echo "$@" >> $log_super + [ -n "$LIBRETRO_LOG_SUPER" ] && echo "$@" >> "$log_super" } echo_cmd() { @@ -39,7 +39,7 @@ libretro_log_init() { if [ -n "$LIBRETRO_LOG_SUPER" ]; then log_super="$LIBRETRO_LOG_DIR/$LIBRETRO_LOG_SUPER" # Redirecting : avoids dependency on trunc(1) - [ -z "$LIBRETRO_LOG_APPEND" ] && : > $log_super + [ -z "$LIBRETRO_LOG_APPEND" ] && : > "$log_super" fi # Module logs are truncated as they're opened in log_module_start } @@ -52,13 +52,13 @@ log_module_start() { exec 6>&1 7>&2 # Redirecting : avoids dependency on trunc(1) - [ -z "$LIBRETRO_LOG_APPEND" ] && : > $log_module + [ -z "$LIBRETRO_LOG_APPEND" ] && : > "$log_module" # Output to screen and logfile in developer mode (if possible) if [[ -n "$LIBRETRO_DEVELOPER" && -n "${log_tee:=$(find_tool "tee")}" ]]; then - exec >> $($log_tee -a $log_module) 2>&1 + exec >> $($log_tee -a "$log_module") 2>&1 else - exec >> $log_module 2>&1 + exec >> "$log_module" 2>&1 log_file_only=1 fi fi