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

Put Searching Parent Directories for Cargo.toml Behind Logical Gate #7871

Open
deg4uss3r opened this issue Feb 6, 2020 · 4 comments
Open
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-filesystem Area: issues with filesystems A-manifest Area: Cargo.toml issues A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@deg4uss3r
Copy link

deg4uss3r commented Feb 6, 2020

Describe the problem you are trying to solve
In cargo-outdated we are seeing an issue (we build the project under /tmp) where if there's a cargo.toml that was moved to /tmp/ cargo build will fail.

Describe the solution you'd like
Either a seperate find_root() (link)that we can trigger from workspace::new(), or a config option to stop the function from crawling upwards (link) in the directory ancestors.

Notes
This was mentioned in #4992 (comment)

I understand this is necessary for cargo and it's the intended function; however, using cargo as an API there should be a way to avoid this :)

@deg4uss3r deg4uss3r added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Feb 6, 2020
@deg4uss3r deg4uss3r changed the title Put Searching Parent Directories Behind logical ate Put Searching Parent Directories Behind Logical Gate Feb 6, 2020
@deg4uss3r deg4uss3r changed the title Put Searching Parent Directories Behind Logical Gate Put Searching Parent Directories for Cargo.toml Behind Logical Gate Feb 6, 2020
@deg4uss3r
Copy link
Author

Just curious if we could chat about this issue? I’m happy to put in a PR :)

@TrondKjeldas
Copy link

Just want to mention another situation where this “feature” can cause problems.

When running cargo in a directory which resides on an NFS mount which is auto mounted, where e.g. /net is the automounter top level.

Cargo searches parent directories until it reaches /net/Cargo.toml, which causes automounter to try to find an NFS export for this name. Depending on the config this can take quite some time before it times out.

@goertzenator
Copy link

This also caused me problems when bringing up rust-analyzer in my dev environment: I was guided to create a Cargo.toml at the root of my large polyglot project so that rust-analyzer could find my crates. This of course moved where the expected Cargo.locks were being generated.

It is surprising to me that something in the Rust ecosystem is so vulnerable to environment side-effects when Rust the language is so very tight about that sort of thing.

@epage
Copy link
Contributor

epage commented Aug 15, 2023

rust-lang/rfcs#3279 is also related to this

@weihanglo weihanglo added A-cargo-api Area: cargo-the-library API and internal code issues S-needs-team-input Status: Needs input from team on whether/how to proceed. labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-filesystem Area: issues with filesystems A-manifest Area: Cargo.toml issues A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

5 participants