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

refactor: canonicalize load paths in load_from functions #1462

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Br1ght0ne
Copy link
Member

@Br1ght0ne Br1ght0ne commented Jul 18, 2024

This helps users by showing an accurate, absolute path in error messages.

Checklist

  • I have linked to any relevant issues.
  • I have updated the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary labels.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@Br1ght0ne Br1ght0ne marked this pull request as draft July 18, 2024 14:31
@Br1ght0ne Br1ght0ne mentioned this pull request Jul 19, 2024
4 tasks
Cargo.toml Show resolved Hide resolved
@Br1ght0ne Br1ght0ne marked this pull request as ready for review July 29, 2024 14:21
`absolute` resolves the path against `workdir`, `clean` removes extra `..` inside.
Using `clean` before `absolute` with paths that go outside of the root
(e.g., "/one/two/../../../above_root") can lead to losing levels of `..`
@digorithm
Copy link
Member

Do you mind resolving these conflicts so we can wrap up this PR?

digorithm
digorithm previously approved these changes Sep 9, 2024
IO,
"could not read predicate binary {clean_file_path:?}. Reason: {e}",
),
Err(e) => error!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be ideal IMO is the following:
read the original path - success - > all good
read the original path -> fails -> clean it up - cleanup successful -> report nice err message
read the original path -> fails -> clean it up -> cleanup fails -> report original err message without mention of the cleanup failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-experience enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants