Skip to content

Cannot run x.py under sudo as non-root user #93344

Closed
@chbaker0

Description

@chbaker0

I am trying to build Rust from source on my project's continuous integration system. I see the following error:

info: looks like you are running this command under `sudo`
      and so in order to preserve your $HOME this will now
      use vendored sources by default.
error: vendoring required, but vendor directory does not exist.
       Run `cargo vendor` without sudo to initialize the vendor directory.

Looking at the message and #40108 it seems the intent is to prevent putting root-owned files in a non-root user's home directory.

Our CI builders use sudo to step down from root to a sandboxed user. See https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8823996676604838337/+/u/build_rust/execution_details for an example environment. I believe it should be safe to build without vendoring in this case.

bootstrap.py should skip the check if SUDO_USER is not root, or an option to bypass this check should be provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions