fix: AfterBuild.sh portability for macOS#7
Closed
jonpepler wants to merge 1 commit into
Closed
Conversation
Two tweaks for bash 3.2 (macOS system default) + BSD coreutils:
- `${authHeader[@]}` on an empty array fires under `set -o nounset`
on bash 3.2. Use the `${arr[@]+"${arr[@]}"}` guard so the empty
case expands to nothing instead.
- `cp -ra` isn't portable: BSD `cp` doesn't accept `-a` in the
combined short form. Replace with plain `cp -R` everywhere
(recursive copy is all the script actually needs — none of the
targets care about preserved timestamps or permissions).
No behaviour change on Linux/CI. Lets contributors run a local
`dotnet build` end-to-end on macOS without the post-build step
exploding.
Owner
Author
|
Superseded by upstream PR TeaGuild#87 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two tiny tweaks so
Telemachus/AfterBuild.shruns successfully on macOS without breaking CI/Linux.Issues fixed
${authHeader[@]}on an empty array fires underset -o nounseton bash 3.2 (macOS system default). Replace with${authHeader[@]+"${authHeader[@]}"}so the empty case expands to nothing instead.cp -raisn't portable — BSDcpdoesn't accept-ain the combined short form. Replace with plaincp -Reverywhere; recursive copy is all the script actually needs, and none of the targets care about preserved timestamps/perms.No behaviour change on Linux
Both forms work identically under GNU
cpand modern bash. The fix just makes the script bash-3.2 + BSD-coreutils safe so a contributor can rundotnet buildend-to-end on macOS without the post-build step exploding.Test plan
dotnet build -c Releasesucceeds on macOS,publish/api-schema.jsonis generated.