Skip to content

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

Merged
jakecoffman merged 1 commit intomainfrom
jakecoffman/cargo-eacces
Oct 10, 2022
Merged

handle path="" correctly in Cargo.toml#5866
jakecoffman merged 1 commit intomainfrom
jakecoffman/cargo-eacces

Conversation

@jakecoffman
Copy link
Copy Markdown
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.

2 participants