S
sunfishcode
blog.sunfishcode.online · Personal blog · on HN since 2021
Dan Gohman, who works on WebAssembly, WASI and Rust systems libraries, writes about capability-based APIs and low-level correctness.
What HN saysHN commenters link it as a source for bugs in hello world, WASI Preview 2 context, and ideas for evolving the WASI filesystem beyond preopens.
32HN people shared it
6linked it in comments
39stories submitted
1.3Kstory points
1 year agolast shared
2021people per year2026
Most-shared posts
- 1Bugs in Hello World5 people · 529 points · first shared 2022 · 252 comments on HN
- 2Errors from `Close`4 people · 58 points · first shared 2024 · 21 comments on HN
- 3Cap-std, a capability-based version of the Rust standard library4 people · 15 points · first shared 2021 · discussion on HN
- 4WASI Preview 2 Launched3 people · 25 points · first shared 2024 · 1 comments on HN
- 5Guarding Against Broken Encapsulation3 people · 12 points · first shared 2021 · 1 comments on HN
- 6WASI API: Capabilities and Filesystems3 people · 9 points · first shared 2024 · 1 comments on HN
- 7Rust programs written entirely in Rust2 people · 167 points · first shared 2021 · 56 comments on HN
- 8No Ghosts2 people · 9 points · first shared 2022 · discussion on HN
- 9Embrace the Kinda: WebAssembly Is a Kinda2 people · 3 points · first shared 2023 · discussion on HN
- 10Is everything a file: the unrecognized complexity of files2 people · 3 points · first shared 2022 · discussion on HN
- 11Eyra Does the Impossible2 people · 2 points · first shared 2023 · 1 comments on HN
- 12Porting Rust's Std to Rustix1 people · 224 points · first shared 2022 · 51 comments on HN
- 13Writing into Uninitialized Buffers in Rust1 people · 129 points · first shared 2025 · 119 comments on HN
- 14First-Class I/O1 people · 81 points · first shared 2021 · 15 comments on HN
- 15WASI 0.2 Launched1 people · 3 points · first shared 2024 · discussion on HN
What HN people wrote when they linked it
kibwen · 2023-11-20
Eyra is a new implementation of libc in Rust that addresses this in its default configuration:
"Eyra solves this by having setenv etc. just leak the old memory. That ensures that it stays valid for as long as any thread needs it. Granted, leaking isn't great, and Eyra makes it configurable with the threadsafe-setenv cargo feature, so it can be disabled in favor of the thread-unsafe implementation. "
https://blog.sunfishcode.online/eyra-does-the-impossible/
ketzu · 2022-03-09
I am not sure either follows. But it depends how we even define "older languages", especially considering differences between python 3 and 2, are they the same age (based on the original python release) or are they treated for their respective release version?
Just taking some simple release dates [1] or wikipedia I found:
Ages of "Yes" group: 49, 36, 22, 26, 26, 12, 31
Ages of "No" group: 11, 14, 33, 7, 32, 45, 26, 34, 21
Averages: Yes 28.85, No 24.78
With the ambiguity around what "age" even means for the language here (e.g., counting the age of node.js or python) it is probably meaningless, but it seems well mixed independent of age.
[1] https://blog.sunfishcode.online/bugs-in-hello-world/
fouronnes3 · 2025-02-24
Depending on the language, this simple code actually has a bug:
https://blog.sunfishcode.online/bugs-in-hello-world/
ricochetcode · 2024-12-15
I'd like to see wasi:filesystem evolve beyond preopens (which would avoid "ghosts" like this) as described in this blog: https://blog.sunfishcode.online/capabilities-and-filesystems/
andoband · 2024-01-26
Another good write-up which gives more context to this release, and it touches on POSIX in relation to the component model.
https://blog.sunfishcode.online/wasi-preview2/
ddulaney · 2023-02-23
> reading from stdin isn’t challenging, nor writing to stdout.
Unless you're Kernighan and Ritchie, who semi-famously wrote a buggy hello world program and used it to educate a generation of C programmers: https://blog.sunfishcode.online/bugs-in-hello-world/
Obviously an exaggeration, but when's the last time you checked the return value of printf? I know I don't. And that's not even a memory safety bug, just basic logic. I hope nobody trusts those guys around malloc and free :)