Skip to content

Unset IFS after its use in set_build_options_for_host #28811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,14 @@ function set_build_options_for_host() {
esac

if [[ "${DARWIN_SDK_DEPLOYMENT_TARGETS}" != "" ]]; then
local IFS=";"; DARWIN_SDK_DEPLOYMENT_TARGETS=($DARWIN_SDK_DEPLOYMENT_TARGETS)
# IFS is immediately unset after its use to avoid unwanted
# replacement of characters in subsequent lines.
local IFS=";"; DARWIN_SDK_DEPLOYMENT_TARGETS=($DARWIN_SDK_DEPLOYMENT_TARGETS); unset IFS

for target in "${DARWIN_SDK_DEPLOYMENT_TARGETS[@]}"; do
local IFS="-"; triple=($target)
# IFS is immediately unset after its use to avoid unwanted
# replacement of characters in subsequent lines.
local IFS="-"; triple=($target); unset IFS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why this is important?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale explanation added as part of c1bdb4f

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can get away with some regular expressions instead of using ifs and trying to parse out the triple. We really want to discourage people doing much in this script. But, if thats not easy, this is okay to merge. It is correcting a defect, which existed previously.

sdk_target=$(toupper ${triple[0]}_${triple[1]})
swift_cmake_options+=(
"-DSWIFTLIB_DEPLOYMENT_VERSION_${sdk_target}=${triple[2]}"
Expand Down