Skip to content

Commit

Permalink
Recorded dependency keys were not quoting spaced values
Browse files Browse the repository at this point in the history
Doubt we need string interpolation here, but it would affect what gets recorded
to the file.
  • Loading branch information
psionic-k committed Oct 4, 2022
1 parent 54f2655 commit d8099d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions overlay/mkcrate-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ linkExternCrateToDeps() {
upper() {
echo "${1^^}"
}
single_quote_whitespaced() {
if [[ $1 == *[[:space:]]* ]]; then
echo "'$1'"
else
echo $1
fi
}

dumpDepInfo() {
local link_flags="$1"; shift
Expand Down Expand Up @@ -123,7 +130,7 @@ dumpDepInfo() {
cp -r "$val" "$dep_file_target"
val=$dep_file_target
fi
printf 'DEP_%s_%s=%s\n' "$(upper "$cargo_links")" "$(upper "$key")" "$val" >> "$dep_keys"
printf 'DEP_%s_%s=%s\n' "$(upper "$cargo_links")" "$(upper "$key")" "$(single_quote_whitespaced "$val")" >> "$dep_keys"
esac
done < "$depinfo"
}
Expand Down Expand Up @@ -165,7 +172,7 @@ install_crate2() {
[[ "$line" =~ cargo:([^=]+)=(.*) ]] || continue
local key="${BASH_REMATCH[1]}"
local val="${BASH_REMATCH[2]}"
printf 'DEP_%s_%s=%s\n' "$(upper "$cargo_links")" "$(upper "$key")" "$val" >> "$out/lib/.dep-keys"
printf 'DEP_%s_%s=%s\n' "$(upper "$cargo_links")" "$(upper "$key")" "$(single_quote_whitespaced "$val")" >> "$out/lib/.dep-keys"
done || :
fi

Expand Down

0 comments on commit d8099d2

Please sign in to comment.