Closed zoraaver closed 1 year ago
is it strictly mentioned in the spec? otherwise, i guess it's safer to allow both error codes. wasmtime returns ENAMETOOLONG, doesn't it?
It's not mentioned in the spec, https://docs.rs/wasi/latest/wasi/fn.fd_prestat_dir_name.html. But I'd say it's better to standardise on a single error code. In this case it shouldn't be much work to change it either way. As far as I understand, the purpose of the tests isn't so that they pass immediately on all runtimes, it's to highlight and standardise any differences in behaviour.
wasmtime returns ENAMETOOLONG, doesn't it?
It probably does since this test is originally from the wasmtime set of tests.
I've raised https://github.com/WebAssembly/WASI/issues/555 to discuss standardising error codes from filesystem functions in general.
It's not mentioned in the spec, https://docs.rs/wasi/latest/wasi/fn.fd_prestat_dir_name.html. But I'd say it's better to standardise on a single error code. In this case it shouldn't be much work to change it either way. As far as I understand, the purpose of the tests isn't so that they pass immediately on all runtimes, it's to highlight and standardise any differences in behaviour.
my point is such a standardization should happen in spec, not tests.
wasmtime returns ENAMETOOLONG, doesn't it?
It probably does since this test is originally from the wasmtime set of tests.
I've raised WebAssembly/WASI#555 to discuss standardising error codes from filesystem functions in general.
i see.
my point is such a standardization should happen in spec, not tests.
True, I've kept both error codes until we decide how to proceed with standardising error codes in general.
In the case that the user provides a buffer which is too small to fit the directory name, it makes more sense to return EINVAL rather than ENAMETOOLONG. ENAMETOOLONG has the speficic connotation that a path was longer than the maximum size permitted by the OS - that doesn't really match this error condition. We're keeping both error codes for now since we don't specify in the docs what error code should be returned.