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

Fix x.py install not working with relative prefix #80797

Merged
merged 1 commit into from
Jan 9, 2021

Conversation

pietroalbini
Copy link
Member

The code powering ./x.py install did not handle relative paths well: the installation script is executed inside a temporary directory, so all the relative paths specified in config.toml and in the DESTDIR environment variable were relative to that temporary directory. The original code fixed the problem for config.toml paths by canonicalizing the prefix, but breaking DESTDIR. #80240 fixed the DESTDIR problem, but also regressed config.toml paths (#80683).

This PR refactors the installation code to generate paths that in my understanding are correct, adding comments in the meantime to explain what each step does. There was no documentation on why choices were made before, so my understanding could actually be wrong.

Regardless, executed ./x.py install with various combinations of config.toml and DESTDIR paths, and everything seems to work according to my understanding. Still, I'd love if @vext01 and @yshui could test these changes.

r? @Mark-Simulacrum
@rustbot modify labels: beta-nominated T-infra

@rustbot rustbot added beta-nominated Nominated for backporting to the compiler in the beta channel. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jan 7, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 7, 2021
@pietroalbini
Copy link
Member Author

cc @cuviper as well, for a double-check from someone with distro experience. I really don't want to screw things here.

@cuviper
Copy link
Member

cuviper commented Jan 7, 2021

The installer script appears to support --destdir -- should we just use that instead?

https://github.com/rust-lang/rust-installer/blob/5254dbfd25d5284728ab624dca1969d61427a0db/install-template.sh#L803

@cuviper
Copy link
Member

cuviper commented Jan 7, 2021

Actually, I'm not sure that --destdir will prepend everything -- looks like it's only applied to the default paths.

@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jan 7, 2021
@vext01
Copy link
Contributor

vext01 commented Jan 8, 2021

Using your branch, I now see binaries, rlibs etc under the install prefix :)

// directory. To prevent relative paths from breaking this converts relative paths to absolute
// paths. std::fs::canonicalize is not used as that requires the path to actually be present.
if path.is_relative() {
path = std::env::current_dir().expect("failed to get the current directory").join(path);
Copy link
Member

Choose a reason for hiding this comment

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

I think current_dir might be confusing here. I would expect it to be config.toml relative probably? I've never used install with relative paths though, and it seems fine to leave this up to future PRs to figure out. It's likely to not be entirely wrong at least.

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 9, 2021

📌 Commit 2caf9bc has been approved by Mark-Simulacrum

@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 Jan 9, 2021
@Mark-Simulacrum Mark-Simulacrum added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jan 9, 2021
@bors
Copy link
Contributor

bors commented Jan 9, 2021

⌛ Testing commit 2caf9bc with merge 46c35c7...

@bors
Copy link
Contributor

bors commented Jan 9, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 46c35c7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 9, 2021
@bors bors merged commit 46c35c7 into rust-lang:master Jan 9, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 9, 2021
@pietroalbini pietroalbini deleted the fix-relative-install branch January 13, 2021 14:44
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.51.0, 1.50.0 Jan 18, 2021
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 18, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2021
…ulacrum

[beta] backports

This backports:

*  Update RLS and Rustfmt rust-lang#81027
*  bump rustfmt to v1.4.32 rust-lang#81093
*  Fix handling of malicious Readers in read_to_end rust-lang#80895
*  Fix broken ./x.py install rust-lang#80514
*  Fix x.py install not working with relative prefix rust-lang#80797
*  [security] Update mdbook rust-lang#80688
*  rustdoc: Render visibilities succinctly rust-lang#80368

r? `@ghost`
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 11, 2021
…r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes rust-lang#81967, a regression introduced by rust-lang#80797. The commit has already been backported to stable 1.50.0.

r? `@Mark-Simulacrum`
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 11, 2021
…r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes rust-lang#81967, a regression introduced by rust-lang#80797. The commit has already been backported to stable 1.50.0.

r? ``@Mark-Simulacrum``
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 11, 2021
…r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes rust-lang#81967, a regression introduced by rust-lang#80797. The commit has already been backported to stable 1.50.0.

r? ````@Mark-Simulacrum````
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 12, 2021
…r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes rust-lang#81967, a regression introduced by rust-lang#80797. The commit has already been backported to stable 1.50.0.

r? `````@Mark-Simulacrum`````
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 12, 2021
…r=Mark-Simulacrum

bootstrap: fix wrong docs installation path

This PR fixes rust-lang#81967, a regression introduced by rust-lang#80797. The commit has already been backported to stable 1.50.0.

r? ``````@Mark-Simulacrum``````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants