WebAssembly / WebAssembly/wasi-libc
Allow mk*temp on WASI
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1k
- Forks
- 251
- Avg merge
- 7h 15m
- Merged PRs (30d)
- 3
Description
Currently, the corresponding code for mkstemp, mkostemp and mkdtemp is commented out, so any C code relying on those functions fails to compile:
https://github.com/WebAssembly/wasi-libc/blob/5ccfab77b097a5d0184f91184952158aa5904c8d/libc-top-half/musl/include/stdlib.h#L116-L120
The comment says it's done because WASI doesn't have temporary directories, however (correct me if I'm wrong), unlike tmpfile, those methods don't need the concept of a system-wide temporary directory.
They accept an explicit filename template, and just generate a unique filename based on it. As such, there's no reason they shouldn't work on WASI.
For example, it should be perfectly possible to create temporary files using template like /mounted-folder/tmp-XXXXXX where /mounted-folder is a valid preopen dir.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the commented mkstemp, mkostemp, and mkdtemp declarations in libc-top-half/musl/include/stdlib.h and review the linked context about WASI temporary directories. Determine how explicit templates and preopened paths should be handled, then verify that C code using these functions compiles and works with a valid mounted folder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, wasm
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100