Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust bootstrap in CI failing for 1.68.0 #108959

Closed
jhheider opened this issue Mar 9, 2023 · 1 comment · Fixed by #108963
Closed

rust bootstrap in CI failing for 1.68.0 #108959

jhheider opened this issue Mar 9, 2023 · 1 comment · Fixed by #108963
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jhheider
Copy link
Contributor

jhheider commented Mar 9, 2023

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

@jhheider jhheider added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Mar 9, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 9, 2023
@jhheider
Copy link
Contributor Author

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

@Nilstrieb Nilstrieb added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Mar 10, 2023
@bors bors closed this as completed in 7918df5 Mar 10, 2023
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants