keymanapp / keymanapp/keyman

chore(ios): 'run script' settings in Xcode configs may not resolve to intended shell

Open
#9,003 11 comments 0 reactions 0 assignees View on GitHub
chore ios/
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

Pretty much the title.

I didn't catch this at the time, but it turns out that #8260's changes can cause issues when building within Xcode; the default bin/sh on my Mac dev machine predates the availability of `declare -g` as introduced in that PR here:

https://github.com/keymanapp/keyman/blob/836d751090e467aaa61dad438f901404fdf45128/resources/build/build-utils.sh#L355-L356

Due to how we include `xcode-utils.sh` in the Run Script's script, its shebang can get bypassed. It turns out that the code _was_ being run from within _**a**_ bash - but an older version than returned by `where bash` - even in the same script!

Changing the "Run Script" shell element to read `/usr/bin/env bash` instead of `bin/sh` allowed me to work around that problem; Xcode then selected the "right" version of bash, where `declare -g` was valid, and the build succeeded.

If there are equivalent steps for our Mac builds, we should probably double-check their corresponding settings.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.