Detect the system on windows instead of reading Windows_NT - #7989
Open
denusklo wants to merge 1 commit into
Open
Detect the system on windows instead of reading Windows_NT#7989denusklo wants to merge 1 commit into
denusklo wants to merge 1 commit into
Conversation
ci/lib.sh works out OS only when the caller has not set one:
if [[ ! ${OS-} ]]; then OS=$(os); fi
Windows predefines OS as Windows_NT in every process environment, so on a
windows shell that test always finds a value, os() is never called, and OS
stays Windows_NT for the whole build. Every question the build then asks about
the system gets an answer it does not understand: which bin scripts to fix up,
whether to build packages, what the release archive is called.
os() already handles this platform -- `cygwin* | mingw*` answers windows -- it
just never gets the chance. Windows_NT is not a name this build knows, so it is
not treated as one a caller chose.
Measured on a windows shell, sourcing the file three ways:
OS unset -> windows (was Windows_NT)
OS=Windows_NT -> windows (was Windows_NT)
OS=linux -> linux (unchanged)
so an explicit choice still wins, which is the point of the check. Nothing
changes anywhere else: no other platform sets OS, so the added test is never
reached off windows.
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.
ci/lib.shworks outOSonly when the caller has not set one:Windows predefines
OSasWindows_NTin every process environment, so on a windows shell that test always finds a value,os()is never called, andOSstaysWindows_NTfor the whole build. Every question the build then asks about the system gets an answer it does not understand: which bin scripts to fix up, whether to build packages, what the release archive is called.os()already handles this platform (cygwin* | mingw*answers windows), it just never gets the chance.Windows_NTis not a name this build knows, so it is not treated as one a caller chose.Measured on a windows shell, sourcing the file three ways:
so an explicit choice still wins, which is the point of the check. Nothing changes anywhere else: no other platform sets
OS, so the added test is never reached off windows.This is the "belongs in its own change" fix named in #7987; with it, that job's
OS: windowsenv line becomes redundant rather than necessary.