Repository navigation
boring-sys: clear repository-local git env vars in build script - #540
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
A build started from a git hook inherits GIT_DIR and related variables, so the build script's git init and git apply ran against the caller's repository instead of the copied BoringSSL sources. From a worktree this writes core.bare = true into the main checkout's config. Fixes cloudflare#527
|
This pull request was not reviewed automatically because its author does not have write access to this repository. A maintainer with write access can start a review by commenting |
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.
Fixes #527.
When
cargo buildruns from a git hook, git has already exportedGIT_DIRand related variables. The build script inherits them, sogit initandgit applyinOUT_DIRrun against the caller's repository instead of the copied BoringSSL sources. When the hook runs in a worktree,git initwritescore.bare = trueinto the main checkout's config, and git commands in the main checkout fail withfatal: this operation must be run in a work tree.Changes
git_command()helper inboring-sys/build/main.rsthat removes the variables listed bygit rev-parse --local-env-vars.gitinvocations (submodule update,init,apply).Testing
The build script has no test harness, so this was checked with a script that simulates a hook in a consumer worktree:
core.bareistrueandgit statusin the main checkout fails.core.bareisfalse,git statusworks, and the patches are applied inOUT_DIR/boringssl, which now gets its own.git.cargo fmt --all -- --check,cargo clippy -p boring-sys --all-targetsandcargo test -p boring(300 + 9 + 39 passed) are clean.