Remove the rights system
sunfishcode opened this issue · 3 comments
As has been observed in #28 (comment), #23, #8, and conversations elsewhere, wasi-filesystems rights system is complex to implement, complex to use, and not very valuable in practice. It doesn't reflect anything in POSIX, so it doesn't give us any extra POSIX compatibility. It requires extra code in libc, both in path_open
to translate POSIX open flags into rights flags, and to translate from ENOTCAPABLE
into POSIX errno values, and we care about code size!
fdstat_t
and path_open
will need a new value to specifying the file mode, which can be either read, write, or read+write.
fd_fdstat_set_rights
will no longer be needed. Note that POSIX doesn't have a way to change the read or write flags on an open file descriptor after it's opened, so this won't remove any POSIX functionality.
Note that, as in POSIX, this would mean that directories must be opened with read (and not write) permissions, and the resulting handle can mutate the filesystem (assuming the filesystem ACLs permit it). As in POSIX, this would mean there's no built in concept of a readonly view of an otherwise writeable filesystem. Such a thing would seem useful, however it's not in POSIX, and it is something that will eventually be implementable with API virtualization, so I'm proposing we just let this be unsupported for now.
[bookkeeping] Added to the Phase 3: wasi-filesystem project board.
I've now created #32 to implement this.
The rights system is now removed from wasi-filesystem.wit.md.