Skip to content

rust bootstrap in CI failing for 1.68.0 #108959

Closed
@jhheider

Description

@jhheider
Contributor

Code

Our existing rust build script fails on 1.68.0 with:

   Compiling sha2 v0.10.2
   Compiling toml v0.5.9
    Finished dev [unoptimized] target(s) in 12.03s
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at 'command did not execute successfully: "git" "rev-list" "--author=bors@rust-lang.org" "-n1" "--first-parent" "HEAD" "--" "/private/var/folders/y3/yr3bxsy95c3gfwwj61ytbp000000gq/T/47aee085/src/llvm-project" "/private/var/folders/y3/yr3bxsy95c3gfwwj61ytbp000000gq/T/47aee085/src/bootstrap/download-ci-llvm-stamp" "/private/var/folders/y3/yr3bxsy95c3gfwwj61ytbp000000gq/T/47aee085/src/version"
expected success, got: exit status: 128', native.rs:154:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Build completed unsuccessfully in 0:00:23
make: *** [install] Error 1

Looking at native.rs, we see the following:

if CiEnv::is_ci() {
        // We assume we have access to git, so it's okay to unconditionally pass
        // `true` here.
        let llvm_sha = detect_llvm_sha(config, true);
...
/// This retrieves the LLVM sha we *want* to use, according to git history.
pub(crate) fn detect_llvm_sha(config: &Config, is_git: bool) -> String {
    let llvm_sha = if is_git {
        let mut rev_list = config.git();

So, it's passing is_git = true categorically if it thinks it's being built in CI, but it seems like it should only do that if it's working in a git checkout. If it's built from release tarballs in a CI system (which sets CI, such as GitHub Actions) it fails as above.

I believe a minimal fix is likely:

# src/bootstrap/native.rs:237
-    if CiEnv::is_ci() {
+    if CiEnv::is_ci() && config.rust_info.is_managed_git_subrepository() {

Version it worked on

It most recently worked on: Rust 1.67.1

Version with regression

1.68.0

Activity

added
C-bugCategory: This is a bug.
regression-untriagedUntriaged performance or correctness regression.
on Mar 9, 2023
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Mar 9, 2023
jhheider

jhheider commented on Mar 10, 2023

@jhheider
ContributorAuthor

I can confirm that that single-line change to native.rs fixes my builds.

added
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Mar 10, 2023
added a commit that references this issue on Mar 10, 2023

Rollup merge of rust-lang#108963 - jhheider:fix-CI-non-git-builds, r=…

7918df5
removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @apiraino@jhheider@rustbot@Noratrieb

      Issue actions

        rust bootstrap in CI failing for 1.68.0 · Issue #108959 · rust-lang/rust