Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

cargo builds can corrupt consumer git repos due to env vars

オープン 初心者向け
#527 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, rust
領域
build-system

調査の方向性

boring-sys/build/main.rs から始め、2 つの git 呼び出し箇所と、既存の git rev-parse --local-env-vars の使用に注目してください。Cargo が hook または worktree から実行されたときに、buildscript がどのように git を呼び出すかを確認してください。これらの呼び出しが、consumer repository に影響を与える可能性のある Git 環境変数を継承しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Problem

The buildscript in boring-sys/build/main.rs calls out to git to set up the BoringSSL sources. When a project using this crate runs cargo from a git hook, git has already set variables like GIT_DIR for the hook. The buildscript here doesn't sanitize those variables, so git init re-initializes the consumer's repo, rather than the BoringSSL repo the buildscript intended.

Normally that's harmless, but when the build is running from a worktree rather than the main checkout, a surprising git interaction causes it to write core.bare = true into the main checkout's config, breaking most git commands in that main checkout until the config is fixed. Unexpected behaviour from git, for sure, but definitely not something we want to trigger from our build.

Proposed fix

Before invoking git in boring-sys/build/main.rs (2 call sites), strip env vars that would alter git's behaviour. git rev-parse --local-env-vars prints a list of those vars; for me, it gives:

GIT_ALTERNATE_OBJECT_DIRECTORIES
GIT_CONFIG
GIT_CONFIG_PARAMETERS
GIT_CONFIG_COUNT
GIT_OBJECT_DIRECTORY
GIT_DIR
GIT_WORK_TREE
GIT_IMPLICIT_WORK_TREE
GIT_GRAFT_FILE
GIT_INDEX_FILE
GIT_NO_REPLACE_OBJECTS
GIT_REPLACE_REF_BASE
GIT_PREFIX
GIT_SHALLOW_FILE
GIT_COMMON_DIR
主要言語
Rust
スター
526
フォーク
178
平均マージ
15時間 34分
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cloudflare/boring のほかの issue

cloudflare/boring の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。