-
Notifications
You must be signed in to change notification settings - Fork 120
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 [limited] support for WASI #138
Conversation
WASI doesn't have a concept of system-wide temporary directory, but at least there is no reason why `new_in` methods with explicit paths should fail. This PR implements support for such methods.
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.
Thanks!
Also, if there is a good way to test this that would be nice. I've run introduced an unfortunate number of bugs in platforms not tested in CI. |
So that's kinda the problem - testing itself is easy, but I was surprised to find that all the currently written tests use methods based on I can write a test or two specifically for |
Take a look in the
You should be able to disable the tempdir tests using a Honestly, coverage isn't really something I'm too concerned about here. I just want to make sure it compiles and basically works. Compiles is probably a high enough bar if you can get that tested in CI. |
I did, but I guess I missed Lines 44 to 52 in 57072e4
Aside from that, all the other tests seem to rely on
Ah, that should be trivial. I'll look into that tomorrow. |
Oh, sorry, I misread. I thought you were saying that only temporary directories were tested. Yeah, I see the issue. Eventually it would probably be a good idea to just pick a sane default for |
Ok I've added two jobs - one for WASI on Rust 1.40.0 on Linux, and one for WASI on nightly Rust with nightly feature on Linux. I believe those should be sufficient, as they cover MSRV as well as nightly build, and we don't want to test all possible combinations as that quickly explodes number of jobs and significantly increases CI time for little benefit. One more thing I noticed is that AppVeyor shows up on Github PR checks and commits, but Travis doesn't - perhaps integration is not correctly enabled in repo settings? |
As for this - I was thinking about potential solutions, and I wonder if a better option would be to expose API to customize root temp dir instead? It would not only avoid hardcoding a default that might not match WASI user's expectations, but also potentially help users on other systems too in case they want to choose a custom root temporary dir (e.g. this could be used as a workaround in #112). I'm not ready to take on this in a follow-up PR (not too much time), just sharing an idea :) |
Ideally, they'd set the default through the system itself (e.g., TMPDIR). I prefer to avoid providing global "setters" as they tend to be abused. |
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.
Thanks!
Yeah that's an option too, but still a little concerning because WASI intentionally doesn't try to emulate POSIX, and intentionally tries not to rely on any environment variables. It's still possible for separate crates to choose to rely on those, of course, but a bit worried that it might create inconsistency between parts of the ecosystem... Maybe a crate-specific env var like |
Although... maybe it wouldn't be too bad. I guess I wish this was defined at WASI level or Rust stdlib level to ensure consistency, but given popularity of this crate, I suppose that should be enough. |
At the moment, I think it's best to wait. I assume the WASI runtime environment will eventually pick something. |
Looks like this made it easy to miss one compilation issue with WASI in latest commit... I'll make a follow-up fix, but I think integration to see checks in Github could be helpful anyway :) https://travis-ci.org/github/Stebalien/tempfile/builds/757241191 |
Unfortunately, travis is switching from travis-ci.org to travis-ci.com. Along with that, they're demanding access to all repos, public and private. In other news, I'm going to be looking for a new CI service. |
FWIW I've been starting new projects as well as migrating some old ones to Github Actions, and it's been a breeze so far. A lot faster than Travis, too. |
Oh, and they have Windows support, definitely faster than AppVeyor as well :) |
Thanks!
|
WASI doesn't have a concept of system-wide temporary directory, but at least there is no reason why
new_in
methods with explicit paths should fail.This PR implements support for such methods.