Skip to content
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

Workaround apple silicon codesigning cache bug #2543

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Jan 31, 2023

This is a hack to work around a codesigning problem on Apple Silicon where overwriting a binary that has already been executed doesn't cause the corresponding codesign entry in the OS cache to update. Mac then prevents the updated binary from running because the signature doesn't match. Removing the file first clears the cache so that we don't run into "zsh: killed ..."

I've updated the magefile so that when we run the install target, the original binaries are removed before we copy. I considered fixing this directly in shx.Copy but lots of people use that and this is a bug in just regular old cp too. So I don't want shx.Copy to do stuff that even cp doesn't.

See:

This is a hack to work around a codesigning problem on Apple Silicon where overwriting a binary that has already been executed doesn't cause the corresponding codesign entry in the OS cache to update. Mac then prevents the updated binary from running because the signature doesn't match. Removing the file first clears the cache so that we don't run into "zsh: killed ..."

I've updated the magefile so that when we run the install target, the original binaries are removed before we copy. I considered fixing this directly in shx.Copy but lots of people use that and this is a bug in just regular old cp too. So I don't want shx.Copy to do stuff that even cp doesn't.

See:
* https://stackoverflow.com/questions/67378106/mac-m1-cping-binary-over-another-results-in-crash
* https://openradar.appspot.com/FB8914231

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs carolynvs marked this pull request as ready for review January 31, 2023 15:48
magefile.go Show resolved Hide resolved
@carolynvs carolynvs merged commit b165007 into getporter:main Jan 31, 2023
@carolynvs carolynvs deleted the fix-apple-codesign-bug branch January 31, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants