badeend commented on issue #7423:
where's all this error-handling code coming from? (...) I'm curious if you're porting from another library for example or something like that.
Not any single place but a combination of: "official" documentations, stack overflow, OS source code, trial-and-error, ..
This seems extensive enough that the tests probably aren't exercising all the various cases
Are you referring to the error mappings in
network.rs -> tcp/udp_bind
andnetwork.rs -> tcp_accept
? Those are indeed not being tested, because I don't know how to without hogging up system resources or them being unreliable.
alexcrichton commented on issue #7423:
Ah ok makes sense. It's not really anything in particular I'm worried about or looking at, but it's lots of little things like:
- https://github.com/bytecodealliance/wasmtime/blob/f63350e06bf032e4c60bc460e4acbbfa6ce5bf48/crates/wasi/src/preview2/host/tcp.rs#L49
- https://github.com/bytecodealliance/wasmtime/blob/f63350e06bf032e4c60bc460e4acbbfa6ce5bf48/crates/wasi/src/preview2/host/tcp.rs#L203
- https://github.com/bytecodealliance/wasmtime/blob/f63350e06bf032e4c60bc460e4acbbfa6ce5bf48/crates/wasi/src/preview2/host/tcp.rs#L254-L268
- https://github.com/bytecodealliance/wasmtime/blob/f63350e06bf032e4c60bc460e4acbbfa6ce5bf48/crates/wasi/src/preview2/host/tcp.rs#L517-L525
- https://github.com/bytecodealliance/wasmtime/blob/f63350e06bf032e4c60bc460e4acbbfa6ce5bf48/crates/wasi/src/preview2/host/tcp.rs#L699-L702
I'm not worried about any of these, mostly curious instead how they all came into existence and if you hit issues locally or if you're copying. Either way is fine, and what you say makes sense, so sounds good to me!
badeend commented on issue #7423:
This is a standard POSIX error code for the bind syscall:
EAFNOSUPPORT: The specified address is not a valid address for the address family of the specified socket.
and complements our own validation slightly higher up in the function. The mapping is there just in case there is an edge case our validation logic didn't catch.
From the docs
From the docs
CI discovered that for me. This is actively tested by:
From the docs. This is actively tested by:
alexcrichton commented on issue #7423:
Thanks for the explanations! When you get a chance it might be goood to have some of that commentary in the code as well.
Last updated: Dec 23 2024 at 12:05 UTC