Skip to content

AltrootFS panics when file does not exist yet #8

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

Closed
sffc opened this issue Jul 25, 2020 · 3 comments
Closed

AltrootFS panics when file does not exist yet #8

sffc opened this issue Jul 25, 2020 · 3 comments

Comments

@sffc
Copy link

sffc commented Jul 25, 2020

Minimal repro:

let fs = vfs::altroot::AltrootFS::new("/tmp");
fs.path("dummy");

If /tmp/dummy does not exist on your filesystem, the above code panics here:

full_path.canonicalize().unwrap();

It seems that canonicalize requires the path to exist, so if the file does not exist yet, then we panic.

I assume this is not the expected behavior, because I think calling .path is the one and only way to create a new file, but right now, AltrootFS panics before I can create the file.

@manuel-woelker
Copy link
Owner

Thanks for the bug report. Looks like this [1] is the root issue, AFAIC there is no clear alternative as of yet.

I am currently in the process of refactoring the API/traits [2], and I will keep this issue in mind when getting to the Altroot/Chroot implementation, and try to find a working solution.

[1] rust-lang/rust#59117
[2] https://github.com/manuel-woelker/rust-vfs/tree/fb-erased-fs-trait

@manuel-woelker
Copy link
Owner

@sffc I just released version 0.3.0, which has completely broken the API, but should fix the issue with path canonicalization.

If you want to take it for a spin and try it out, please let me know if this fixes the problem. Thanks!

@manuel-woelker
Copy link
Owner

Closing since this should be fixed now, please feel free to open a new issue if you have any further problems.

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

No branches or pull requests

2 participants