Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(uhyve): use absolute paths #1529

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

n0toose
Copy link
Member

@n0toose n0toose commented Dec 25, 2024

Instead of handling the null terminators ourselves, we relied on the FUSE implementation to store a “prefix” in UhyveDirectory and began using CStrings instead.

This is based on the previous work of Çağatay Yiğit Şahin (58da426).

Copy link
Member Author

@n0toose n0toose left a comment

Choose a reason for hiding this comment

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

The change works well enough using the latest version of Uhyve using both /root/foo.txt and /root/guest_directory/foo.txt with the file mappings:

  • --file-mapping foo.txt:/root/guest_directory/foo.txt
  • --file-mapping ./:/root/guest_directory/
  • --file-mapping .////:/root/guest_directory
  • --file-mapping .:/root/guest_directory

Some edge cases exist, particularly --file-mapping ./:/root -- however, this problem existed before when entering "" instead of /root (the prefix), as we do now. I believe that my change follows the principle of "perfect is the enemy of good" and that it's better than it was before.

Nevertheless, I left two comments in places that could use a second pair of eyes.

src/fs/uhyve.rs Outdated Show resolved Hide resolved
// Unlike src/fs/fuse.rs, we skip the first element here so as to not prepend / before /root
let path: String = components_with_prefix
.flat_map(|component| ["/", component])
.skip(1)
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about this skip.

Instead of handling the null terminators ourselves, we relied on the
FUSE implementation to store a "prefix" in UhyveDirectory and begun
using CStrings instead.

This is based on the previous work of Çağatay Yiğit Şahin.
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks! :)

@mkroening mkroening added this pull request to the merge queue Jan 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 3, 2025
@mkroening mkroening added this pull request to the merge queue Jan 3, 2025
Merged via the queue into hermit-os:main with commit 4744bcc Jan 3, 2025
13 checks passed
n0toose added a commit to n0toose/uhyve that referenced this pull request Jan 5, 2025
Ported from hermit-os#816, fixes a regression introduced by
hermit-os/kernel#1529,
which modified the Hermit kernel so that it uses absolute paths instead
of relative ones.
github-merge-queue bot pushed a commit to hermit-os/uhyve that referenced this pull request Jan 9, 2025
Ported from #816, fixes a regression introduced by
hermit-os/kernel#1529,
which modified the Hermit kernel so that it uses absolute paths instead
of relative ones.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants