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

Add home_dir for WASI #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add home_dir for WASI #26

wants to merge 1 commit into from

Conversation

HKalbasi
Copy link

This PR adds home_dir implementation for Web Assembly System Interface (WASI) target, that uses HOME environment variable. Since WASI lacks concept of user, I think this is the way to go.

Lacking this function makes porting binaries to WASI unnecessarily harder.

@LucioFranco
Copy link
Collaborator

@HKalbasi hi! sorry for the delay but do you have a doc or reference for what wasi sets?

@HKalbasi
Copy link
Author

I think, ..., it doesn't really matter? WASI doesn't have concept of users, and its filesystem is isolated and sandboxed, by using $HOME codes will compile and people can change it to whatever they want at runtime (probably /). From what I have seen before, WASI is more close to unix than windows so I think $HOME is good choice.

But to make sure, I opened WebAssembly/wasi-filesystem#59

@turbolent
Copy link

turbolent commented Feb 18, 2023

@brson Could this PR please get merged? Some applications, like https://github.com/helix-editor/helix, depend on this crate, and compilation of the home crate for WASI fails at the moment.

Assuming the HOME environment variable is set seems reasonable – WASI is close to POSIX.

@HKalbasi
Copy link
Author

HKalbasi commented Feb 18, 2023

@turbolent It is not clear which solution is the correct one for WASI. You might want to say your opinion on WebAssembly/wasi-filesystem#59

@turbolent
Copy link

Well, having a possible implementation which is close to what other platforms do is still better than none. Given there is no "correct" one. Currently, the missing implementation means applications using it do not build at all.

@HKalbasi
Copy link
Author

The suggested implementation in that issue is unconditionally returning None, which doesn't work for my use case. If it works for helix, I think it can also make home option dependency and cfg it out.

@LucioFranco
Copy link
Collaborator

Btw all maintenance of this project has moved into cargo's repository.

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.

3 participants