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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle path="" correctly in Cargo.toml #5866

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Conversation

jakecoffman
Copy link
Member

@jakecoffman jakecoffman commented Oct 10, 2022

It's valid for dependencies in Cargo.toml to point to the package itself with a path of "". So in package jake you could have:

[dev-dependencies]
jake = { path = "" }

This results in Dependabot doing a File.join("", "Cargo.toml") which creates /Cargo.toml instead of Cargo.toml. When it goes to create the file it gets an "Access Denied" error since root isn't writable by the dependabot container user.

This fix trims the leading "/" if present so it correctly returns Cargo.toml.

I considered altering next unless details["path"] to also skip blank paths, but I think the way I've done it here is more correct, as it really is a path dependency and should be returned from path_dependency_paths_from_file. Not sure if that will ever matter though 馃槂

@jakecoffman jakecoffman merged commit 4bd7127 into main Oct 10, 2022
@jakecoffman jakecoffman deleted the jakecoffman/cargo-eacces branch October 10, 2022 15:09
@pavera pavera mentioned this pull request Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants