Skip to content

Building rustc-1.84.0 tarball fails with git error "fatal: --local can only be used inside a git repository" #135358

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

Closed
etna opened this issue Jan 11, 2025 · 14 comments · Fixed by #135433
Assignees
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Milestone

Comments

@etna
Copy link

etna commented Jan 11, 2025

I am trying to build the official tarball on Linux and it fails with the following error:

Finished `dev` profile [unoptimized] target(s) in 0.70s
fatal: --local can only be used inside a git repository
fatal: not a git repository (or any of the parent directories): .git
thread 'main' panicked at src/core/config/config.rs:2908:89:
called `Result::unwrap()` on an `Err` value: "command did not execute successfully: cd \"/home/builder/Tmpdir/rustc-1.84.0-src\" && \"git\" \"rev-list\" \"--author=bors@rust-lang.org\" \"-n1\" \"--first-parent\" \"HEAD\"\nexpected success, got: exit status: 128\n"
stack backtrace:
   0:     0x556f85b3c316 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::ha954892228d36427
   1:     0x556f85b64203 - core::fmt::write::h57d13a959b226250
   2:     0x556f85b181df - std::io::Write::write_fmt::h14c9ac269063afe6
   3:     0x556f85b3c1b3 - std::sys::backtrace::BacktraceLock::print::hf969c1fd7e824e94
   4:     0x556f85b290ad - std::panicking::default_hook::{{closure}}::h45647cb6a8d1ea15
   5:     0x556f85b28ec2 - std::panicking::default_hook::h2dcc389a6edb8d15
   6:     0x556f85b29533 - std::panicking::rust_panic_with_hook::h243558d255d6afd1
   7:     0x556f85b3c6da - std::panicking::begin_panic_handler::{{closure}}::h17209e01ce2aa329
   8:     0x556f85b3c519 - std::sys::backtrace::__rust_end_short_backtrace::hbeff08fd2d23fd72
   9:     0x556f85b2914c - rust_begin_unwind
  10:     0x556f84e06220 - core::panicking::panic_fmt::h600b93cf9acabfc7
  11:     0x556f84e06bb6 - core::result::unwrap_failed::hd0f0a7f7f80f29eb
  12:     0x556f84e5abdd - core::result::Result<T,E>::unwrap::hdcce4d4cbb4ca39f
                               at /home/builder/Tmpdir/rustc-1.83.0-src/library/core/src/result.rs:1104:23
  13:     0x556f84e5abdd - bootstrap::core::config::config::Config::last_modified_commit::h0e5bf6b59b9537e9
                               at /home/builder/Tmpdir/rustc-1.84.0-src/src/bootstrap/src/core/config/config.rs:2908:22
  14:     0x556f84e5a266 - bootstrap::core::config::config::Config::download_ci_rustc_commit::h6e7a14b43ced4064
                               at /home/builder/Tmpdir/rustc-1.84.0-src/src/bootstrap/src/core/config/config.rs:2820:28
  15:     0x556f8514e8c2 - bootstrap::core::config::config::Config::parse_inner::ha7f9a830d56f200a
                               at /home/builder/Tmpdir/rustc-1.84.0-src/src/bootstrap/src/core/config/config.rs:1775:17
  16:     0x556f84e555ad - bootstrap::core::config::config::Config::parse::h294bff55ae4cccc9
                               at /home/builder/Tmpdir/rustc-1.84.0-src/src/bootstrap/src/core/config/config.rs:1305:9
  17:     0x556f84e0c42c - bootstrap::main::he2af89d8870d09bd
                               at /home/builder/Tmpdir/rustc-1.84.0-src/src/bootstrap/src/bin/main.rs:27:18
  18:     0x556f84e084a3 - core::ops::function::FnOnce::call_once::haf58ca782caa1c52
                               at /home/builder/Tmpdir/rustc-1.83.0-src/library/core/src/ops/function.rs:250:5
  19:     0x556f84e10966 - std::sys::backtrace::__rust_begin_short_backtrace::h173f508882ed3517
                               at /home/builder/Tmpdir/rustc-1.83.0-src/library/std/src/sys/backtrace.rs:154:18
  20:     0x556f84e072a9 - std::rt::lang_start::{{closure}}::h41c6084881d81864
                               at /home/builder/Tmpdir/rustc-1.83.0-src/library/std/src/rt.rs:195:18
  21:     0x556f85b26a80 - std::rt::lang_start_internal::hec001d8d383763ba
  22:     0x556f84e07287 - std::rt::lang_start::hbc106bd9b8bea089
                               at /home/builder/Tmpdir/rustc-1.83.0-src/library/std/src/rt.rs:194:17
  23:     0x556f84e0ee4e - main
  24:     0x149dee2bd1ca - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  25:     0x149dee2bd285 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  26:     0x556f84e06bf1 - _start
  27:                0x0 - <unknown>
Build completed unsuccessfully in 0:03:01

Using the same config.toml file on the tarball for rustc 1.83 works with no problems, so this seems to be limited to the 1.84 tarball. Please kindly assist, thank you.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 11, 2025
@jieyouxu jieyouxu added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 11, 2025
@Noratrieb
Copy link
Member

what's your config.toml?

@Noratrieb
Copy link
Member

I see the one from @truboxl backlinked from termux: https://github.com/termux/termux-packages/blob/0366d87f0e811efadd6de798cbc8220c216d2faa/packages/rust/config.toml#L4

You need to set profile = "dist" at the top to get a configuration that properly works for building (which is set automatically by ./configure). The dist profile disables download-rustc, whose logic is only intended to be used in a Git repository.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Jan 11, 2025
@onur-ozkan
Copy link
Member

We shouldn't allow using "if-unchanged" on non-git sources.

@Noratrieb
Copy link
Member

Noratrieb commented Jan 11, 2025

Maybe it would also be good to force people to set profile = "dist" in non-git sources? Relying on the config instead of whether it's Git or not seems more reliable and less prone to mistakes. (nice errors would be cool of course)

@onur-ozkan
Copy link
Member

I think that wouldn't be enough as can simply override the defaults.

@jyn514
Copy link
Member

jyn514 commented Jan 11, 2025

defaulting to (but not forcing) profile = dist in non-git sources seems like a good change. i agree with onur that we should additionally add a helpful error when combining download-* with non-git sources.

@etna
Copy link
Author

etna commented Jan 12, 2025

Adding profile = "dist" results in a successful build, thank you very much.

I am fine with manually declaring profile = "dist" in my config.toml if it is clearly stated and described in the tarball's config.toml.example

@etna etna closed this as completed Jan 12, 2025
@etna
Copy link
Author

etna commented Jan 12, 2025

Sorry, closed by mistake; please re-open if needed.

@jieyouxu jieyouxu reopened this Jan 12, 2025
@onur-ozkan onur-ozkan added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Jan 12, 2025
@onur-ozkan
Copy link
Member

Mentoring instructions:

  • Override profile (only when it's None) to dist for non-git sources in python script bootstrap.py.
  • Assert that if-unchanged options (for download-ci-llvm and download-rustc) are not used on non-git sources.

@tanvincible
Copy link
Contributor

@rustbot claim

@tanvincible
Copy link
Contributor

Hello @onur-ozkan! Am I required to write unit tests also?

@onur-ozkan
Copy link
Member

Hello @onur-ozkan! Am I required to write unit tests also?

Having coverage for this change would be really great.

tanvincible added a commit to tanvincible/rust that referenced this issue Jan 13, 2025
tanvincible added a commit to tanvincible/rust that referenced this issue Jan 13, 2025
tanvincible added a commit to tanvincible/rust that referenced this issue Jan 13, 2025
@bors bors closed this as completed in bdd88dd Jan 20, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 20, 2025
Rollup merge of rust-lang#135433 - tanvincible:patch-1, r=onur-ozkan

Add Profile Override for Non-Git Sources

## PR description

- Fixes rust-lang#135358

This PR introduces the following updates to

1. `bootstrap.py`:
    - If the `profile` is `None` and the source is non-git, the `profile` is automatically overridden to `"dist"`.
    - Ensures that options like `download-ci-llvm` and `download-rustc` are not used with non-git sources. An exception is raised if these options are present in the configuration when the source is non-git.

2. `bootstrap_test.py`
   - Added unit tests to verify both the profile override mechanism and the assertion for restricted options.
These tests ensure the correct behavior for non-git sources and the handling of `if-unchanged` options.

r? `@onur-ozkan`
`@rustbot` T-bootstrap
@cuviper cuviper added this to the 1.84.1 milestone Jan 30, 2025
@xry111
Copy link
Contributor

xry111 commented Jan 31, 2025

Mentoring instructions:

  • Override profile (only when it's None) to dist for non-git sources in python script bootstrap.py.

Is this really enough? With a rustc-1.84.1 release tarball I still don't get the behavior of profile = "dist" unless I explicitly add it into config.toml. To me the logic needs to be added into Config::parse_inner in src/bootstrap/src/core/config.config.rs. Or am I misunderstanding the intention of this change?

@onur-ozkan
Copy link
Member

onur-ozkan commented Jan 31, 2025

Mentoring instructions:

  • Override profile (only when it's None) to dist for non-git sources in python script bootstrap.py.

Is this really enough? With a rustc-1.84.1 release tarball I still don't get the behavior of profile = "dist" unless I explicitly add it into config.toml. To me the logic needs to be added into Config::parse_inner in src/bootstrap/src/core/config.config.rs. Or am I misunderstanding the intention of this change?

Yeah, profile overriding (to "dist") logic should be duplicated on Rust side too.

Note: This doesn't have anything to do with the original error reported in the issue. It was fixed with #135722.

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. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. 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.

9 participants