Skip to content

os/mac/diagnostic: check SDK version in SDKSettings matches the path#10552

Merged
Bo98 merged 5 commits intoHomebrew:masterfrom
Bo98:sdk-checks
Feb 11, 2021
Merged

os/mac/diagnostic: check SDK version in SDKSettings matches the path#10552
Bo98 merged 5 commits intoHomebrew:masterfrom
Bo98:sdk-checks

Conversation

@Bo98
Copy link
Copy Markdown
Member

@Bo98 Bo98 commented Feb 7, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?
  • Have you successfully run brew man locally and committed any changes?

The CLT 10.x -> 11.x upgrade process on 10.14 contained a bug which broke the SDKs. Notably, MacOSX10.14.sdk would indirectly symlink to MacOSX10.15.sdk. This PR is an attempt to detect installations with this broken setup.

The first commit lays the groundwork by redoing the SDK version detection system to be based on SDKSettings rather than solely on paths. The SDKSettings file more accurately describes what the contents of the SDK represent... because it is a part of the said contents. As a result it's now technically possible to have two SDKs with the same version (though working installations shouldn't do), but brew will continue to only actually use the first one it finds.

Note that brew will now ignore SDKs without a SDKSettings file. No official macOS SDK shipped without one so this should not break any unmodified installations.

The second commit adds the actual diagnostic. It checks the SDK version (which is now read from SDKSettings) and sees if it matches the version in the path. If it does not, it is a big indication that the SDK installation is broken.

This PR should fail brew doctor on the 10.14 VMs just now. I hope to fix those VMs as soon as possible (Monday/Tuesday).

I have not yet tested this PR on anything other than Mojave.

@BrewTestBot
Copy link
Copy Markdown
Contributor

Review period will end on 2021-02-09 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 7, 2021
@Bo98 Bo98 force-pushed the sdk-checks branch 4 times, most recently from a74966c to 9ef2763 Compare February 7, 2021 05:36
@Bo98 Bo98 force-pushed the sdk-checks branch 2 times, most recently from 08f5555 to 403a693 Compare February 8, 2021 16:58
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 9, 2021
@BrewTestBot
Copy link
Copy Markdown
Contributor

Review period ended.

@MikeMcQuaid MikeMcQuaid requested a review from carlocab February 9, 2021 11:16
Comment on lines 47 to 49
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Side note: am I the only one who dislikes this indentation and prefers consistent over special_inside_parentheses?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeh, consistent is much nicer. Can you submit a PR to change the rule and autocorrect?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I'll do that separately (maybe after this is merged).

Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Fine with me 👍🏻. Would like @carlocab to also be 👍🏻 and ideally a few more tests but nothing blocking.

@MikeMcQuaid MikeMcQuaid requested a review from carlocab February 10, 2021 14:26
@Bo98
Copy link
Copy Markdown
Member Author

Bo98 commented Feb 11, 2021

Coverage 💯

(ok, it's 97% but is a test on installation_instructions worth it?)

@MikeMcQuaid
Copy link
Copy Markdown
Member

Great work @Bo98 👏🏻. :shipit:!

@Bo98 Bo98 merged commit 0f4ccd7 into Homebrew:master Feb 11, 2021
@Bo98 Bo98 deleted the sdk-checks branch February 11, 2021 12:53
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Feb 15, 2021
This reverts commit f4e69f8.

It is no longer necessary after the fix to the mismatched Mojave SDK.

Context: Homebrew/brew#10552
BrewTestBot pushed a commit to Homebrew/homebrew-core that referenced this pull request Feb 17, 2021
This reverts commit f4e69f8.

It is no longer necessary after the fix to the mismatched Mojave SDK.

Context: Homebrew/brew#10552
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Mar 14, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Mar 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants