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

Compiler build toolchain does not respect build-dir for cargo bash completions #113728

Open
samkhn opened this issue Jul 15, 2023 · 4 comments
Open
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@samkhn
Copy link

samkhn commented Jul 15, 2023

I am compiling the rust toolchain from source (this includes cargo, clippy, rustdoc, rust-analyzer and src). I am installing it in a custom folder in my home directory.

When I run ./x.py install, it appropriately compiles and installs all of those binaries. However, along the way, the script invokes a copy to /etc/bash_completions.d/cargo and appropriately logs that it doesn't have permissions.

I expect that ./x.py will respect my build-dir argument and try to install the bash completions in build-dir/etc instead of /etc

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 15, 2023
@samkhn
Copy link
Author

samkhn commented Jul 15, 2023

My config.toml does not specify a sysconfdir value. By default, it is "/etc". Because it is /etc, it will attempt to install it at root and ignore the build dir prefix: source. This behavior seems a tad bit strange. Shouldn't it be "if the prefix is specified, we'll append sysconfdir" to it similar to the other options "otherwise we'll use default /etc". Then the pathjoining library can resolve join("", "/etc") which is the default and join("/home/user/install/rust", "/etc")?

@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jul 15, 2023
@jyn514
Copy link
Member

jyn514 commented Jul 15, 2023

we should already be respecting prefix if you set it:

let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc"));

can you post the exact error you're seeing, your config.toml, and the commit you're trying to install?

@jyn514 jyn514 added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 15, 2023
@jyn514
Copy link
Member

jyn514 commented Jul 15, 2023

ok, this replicates the issue:

[build]
extended = true

[install]
prefix = "install-dir"

and the error is

; x install
Installing stage2 cargo (x86_64-unknown-linux-gnu)
install: creating uninstall script at /home/jyn/src/rust2/install-dir/lib/rustlib/uninstall.sh
install: installing component 'cargo'
cp: cannot create regular file '/etc/bash_completion.d/cargo': Permission denied
chmod: cannot access '/etc/bash_completion.d/cargo': No such file or directory
install: error: file creation failed. see logs at '/home/jyn/src/rust2/install-dir/lib/rustlib/install.log'

@jyn514 jyn514 added C-bug Category: This is a bug. and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Jul 15, 2023
@jyn514
Copy link
Member

jyn514 commented Jul 15, 2023

ah, i see the problem - prefix.join("/etc") just results in /etc, because it's an absolute path. that seems ... confusing. https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.join

anyway, i'll have a fix up shortly.

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. 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.

3 participants