This repository has been archived by the owner on Mar 28, 2021. It is now read-only.
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.
Pull Request
Problem
See tj/n#623.
This PR is the same implementation done in tj/n#624.
macOS 11 has been announced. At the moment, the system check in can_use_xz() only cares about the OS minor version being greater than 8, so as it stands,
n
would think the upcoming macOS 11.0.0 doesn't support xz decompression via tar. Downloads would fall back to fetching gzip tarballs.(I think it's reasonable to assume Apple will keep xz support in tar, as opposed to abruptly dropping it.)
Solution
In this PR, the check in can_use_xz() now allows any major macOS version 11+, in addition to allowing any macOS with minor version 8 or greater.
An aside about `sw_vers` and why this loose logic is good enough (Click to expand.)
We check the macOS version with the
sw_vers
utility. The only Mac operating system versions with thesw_vers
utility are versions 10+. On old enough OS X/Mac OS,sw_vers
command doesn't exist; As such, I'd expect to see this onstderr
:As that output is on
stderr
and nothing is instdout
,$macos_version
holds an empty string and fails the version check. In this scenario, I would expectn
to fall back to usinggzip
.(I simulated that scenario by being on Ubuntu (no
sw_vers
command here!) and settingmacos_version="$(sw_vers -productVersion)"
and running the version checks against this$macos_version
, which indeed was an empty string and failed the version checks.)My mental "truth table" of this check, considering all that, is as follows:
This all looks correct to me, and I'm satisfied the logic theoretically works as intended. Typos or bugs notwithstanding.
ChangeLog
Enable xz support by default for macOS 11+