Description
Currently, WASI target implements retrieving permissions with a no-op and just returning a default value:
rust/src/libstd/sys/wasi/fs.rs
Lines 75 to 78 in a237641
However, the corresponding setter method is instead implemented by returning an error:
rust/src/libstd/sys/wasi/fs.rs
Lines 424 to 428 in a237641
This is unfortunate and breaks higher-level APIs like std::fs::copy
which currently manages to successfully copy contents of file on a WASI target but then fails because the default implementation unconditionally calls set_permissions
:
rust/src/libstd/sys_common/fs.rs
Lines 19 to 21 in d8bdb3f
To both fix such issues and from a semantic point of view, too, it seems it would be better to mirror the behaviour of the getter (permissions
method) and just perform no-op in set_permissions
on a WASI target, at least until WASI specification decides to extend support and add real permissions model.
Would the team be open to this?