Skip to content

Allow running x <cmd> <path> from a different directory - #146774

Merged
bors merged 1 commit into
rust-lang:masterfrom
Kobzol:bootstrap-relative-path
Sep 20, 2025
Merged

Allow running x <cmd> <path> from a different directory#146774
bors merged 1 commit into
rust-lang:masterfrom
Kobzol:bootstrap-relative-path

Conversation

@Kobzol

@Kobzol Kobzol commented Sep 19, 2025

Copy link
Copy Markdown
Member

Fixes: #146772

r? @jieyouxu

@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 Sep 19, 2025
@rustbot

rustbot commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

jieyouxu is currently at their maximum review capacity.
They may take a while to respond.

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, I think this itself makes sense, though I don't know 100% if there are tools that intend to behave differently when run under source root versus in an inner directory. I don't think so?

View changes since this review

@jieyouxu

Copy link
Copy Markdown
Member

Thanks
@bors r+ rollup

@bors

bors commented Sep 20, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 58814bc has been approved by jieyouxu

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 Sep 20, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 20, 2025
…jieyouxu

Allow running `x <cmd> <path>` from a different directory

Fixes: rust-lang#146772

r? `@jieyouxu`
bors added a commit that referenced this pull request Sep 20, 2025
Rollup of 6 pull requests

Successful merges:

 - #144592 (generate list of all variants with `target_spec_enum`)
 - #146762 (Fix and provide instructions for running test suite on Apple simulators)
 - #146766 (Add attributes for #[global_allocator] functions)
 - #146770 (fixes for numerous clippy warnings)
 - #146774 (Allow running `x <cmd> <path>` from a different directory)
 - #146800 (Fix unsupported `std::sys::thread` after move)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 20, 2025
Rollup of 5 pull requests

Successful merges:

 - #144592 (generate list of all variants with `target_spec_enum`)
 - #146762 (Fix and provide instructions for running test suite on Apple simulators)
 - #146770 (fixes for numerous clippy warnings)
 - #146774 (Allow running `x <cmd> <path>` from a different directory)
 - #146800 (Fix unsupported `std::sys::thread` after move)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit f5725f0 into rust-lang:master Sep 20, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 20, 2025
rust-timer added a commit that referenced this pull request Sep 20, 2025
Rollup merge of #146774 - Kobzol:bootstrap-relative-path, r=jieyouxu

Allow running `x <cmd> <path>` from a different directory

Fixes: #146772

r? ``@jieyouxu``
@tgross35

Copy link
Copy Markdown
Contributor

@bors r- already merged but still in the queue

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 20, 2025
@Kobzol
Kobzol deleted the bootstrap-relative-path branch September 21, 2025 05:53
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 22, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#144592 (generate list of all variants with `target_spec_enum`)
 - rust-lang/rust#146762 (Fix and provide instructions for running test suite on Apple simulators)
 - rust-lang/rust#146770 (fixes for numerous clippy warnings)
 - rust-lang/rust#146774 (Allow running `x <cmd> <path>` from a different directory)
 - rust-lang/rust#146800 (Fix unsupported `std::sys::thread` after move)

r? `@ghost`
`@rustbot` modify labels: rollup
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
…jieyouxu

Allow running `x <cmd> <path>` from a different directory

Fixes: rust-lang#146772

r? ``@jieyouxu``
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Sep 24, 2025
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#144592 (generate list of all variants with `target_spec_enum`)
 - rust-lang#146762 (Fix and provide instructions for running test suite on Apple simulators)
 - rust-lang#146770 (fixes for numerous clippy warnings)
 - rust-lang#146774 (Allow running `x <cmd> <path>` from a different directory)
 - rust-lang#146800 (Fix unsupported `std::sys::thread` after move)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 11, 2026
bootstrap: Simplify absolute path handling

The existing code takes a command-line argument (that might not even be a path), glues it to the repository path, makes it absolute relative to the working directory, then tries to strip the repository path off again.

That all seems needlessly complicated.

The new approach is much simpler: If an argument is an absolute path that exists, try to strip the repository path from it, or otherwise change nothing. That should hopefully give the same results in every useful case.

---

Relevant earlier PRs:
- rust-lang#126782
- rust-lang#146774

r? Kobzol (who last modified this code), or bootstrap
rust-timer added a commit that referenced this pull request Aug 11, 2026
Rollup merge of #160855 - Zalathar:absolute, r=Kobzol

bootstrap: Simplify absolute path handling

The existing code takes a command-line argument (that might not even be a path), glues it to the repository path, makes it absolute relative to the working directory, then tries to strip the repository path off again.

That all seems needlessly complicated.

The new approach is much simpler: If an argument is an absolute path that exists, try to strip the repository path from it, or otherwise change nothing. That should hopefully give the same results in every useful case.

---

Relevant earlier PRs:
- #126782
- #146774

r? Kobzol (who last modified this code), or bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Invoking x from a different directory seems to interpret build targets in a surprising way

5 participants