-
Notifications
You must be signed in to change notification settings - Fork 88
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
Conversation
There was a problem hiding this 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.
// 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) |
There was a problem hiding this comment.
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.
2b33fd0
to
818df0d
Compare
There was a problem hiding this 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! :)
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.
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.
Instead of handling the null terminators ourselves, we relied on the FUSE implementation to store a “prefix” in
UhyveDirectory
and began usingCString
s instead.This is based on the previous work of Çağatay Yiğit Şahin (58da426).