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

bootstrap: don't resolve symlinks for initial_cargo #121341

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

GrigorenkoPV
Copy link
Contributor

I have put the following in my config.toml:

# Includes one of the default files in src/bootstrap/defaults
profile = "compiler"
change-id = 121203

[build]
cargo = "/usr/bin/cargo"
rustc = "/usr/bin/rustc"
rustfmt = "/usr/bin/rustfmt"

I have rustup installed from Arch's repos, which has all of the above paths be symlinks to /usr/bin/rustup. This works just fine with the argv[0] trick that rustup uses.

However, bootstrap resolves symlinks to check whether cargo exists and then uses the resolved path, so it ends up calling rustup directly expecting it to behave like cargo. Which it doesn't.

This PR removes the canonicalization step, in turn fixing the issue, but sacrificing a pretty error message. However, this exact thing is checked by x.py in advance, so I hope it is not a big deal?

@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2024

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 20, 2024
@rustbot
Copy link
Collaborator

rustbot commented Feb 20, 2024

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stopping bootstrapping on the invalid configuration is actually quite useful (so people doesn't waste time on building when configuration is invalid). I would rather change this validation to be running a simple cargo command and checking if it's working or not. With this approach, your usecase should be working just fine and we can keep validating the initial cargo.

@onur-ozkan
Copy link
Member

r? onur-ozkan

@rustbot rustbot assigned onur-ozkan and unassigned clubby789 Feb 20, 2024
@onur-ozkan onur-ozkan added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 20, 2024
@GrigorenkoPV
Copy link
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 20, 2024
@bors
Copy link
Contributor

bors commented Feb 21, 2024

☔ The latest upstream changes (presumably #121400) made this pull request unmergeable. Please resolve the merge conflicts.

}
PathBuf::from(cargo)
} else {
config.download_beta_toolchain();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this fixes a bug. Thanks :)

@onur-ozkan
Copy link
Member

I will take this to the merge queue once it's been rebased and the commits have been squashed/unified. Having the first commit no longer makes sense.

+ Do not resolve symlinks (as this may break rustup)
+ Check version not just for rustc, but also for cargo.
+ Check that the program's self-reported name
  matches the expected name (such as "rustc" or "cargo").
@onur-ozkan
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 22, 2024

📌 Commit c42057f has been approved by onur-ozkan

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 22, 2024
@bors
Copy link
Contributor

bors commented Feb 23, 2024

⌛ Testing commit c42057f with merge 71ff1c6...

@bors
Copy link
Contributor

bors commented Feb 23, 2024

☀️ Test successful - checks-actions
Approved by: onur-ozkan
Pushing 71ff1c6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 23, 2024
@bors bors merged commit 71ff1c6 into rust-lang:master Feb 23, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 23, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (71ff1c6): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-5.1%, -5.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-5.4%, -4.9%] 2
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-3.7%, -1.6%] 13
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 651.286s -> 650.172s (-0.17%)
Artifact size: 310.96 MiB -> 310.96 MiB (-0.00%)

@GrigorenkoPV GrigorenkoPV deleted the bootstrap-rustup-cargo branch February 23, 2024 10:30
@GrigorenkoPV
Copy link
Contributor Author

Thank you a lot for the review and the feedback!

Really appreciate it ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants