Revert "libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overl…#4448
Revert "libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overl…#4448yamt wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
…ook their access modes (bytecodealliance#3694)" This reverts commit 67fa155. because it broke certain use cases while it isn't clear what it fixed. tested with: https://github.com/yamt/garbage/tree/master/wasm/httpd https://github.com/yamt/garbage/tree/master/wasm/tty cf. bytecodealliance#4447 bytecodealliance#3686 (comment)
|
I mostly agree that STDXXX can have variant But, are you suggesting that removing read/write bits based on the access mode is acceptable according to STDXX? switch (access_mode) {
case WASI_LIBC_ACCESS_MODE_READ_ONLY:
*rights_base &= ~(__wasi_rights_t)__WASI_RIGHT_FD_WRITE;
break;
case WASI_LIBC_ACCESS_MODE_WRITE_ONLY:
*rights_base &= ~(__wasi_rights_t)__WASI_RIGHT_FD_READ;
break;
} |
yes. i think it's the most straightforward behavior. |
|
The main concern is that after this modification, the code below will allow STDIN to be unreadable and STDOUT to be unwritable in some scenarios, which I don't think should be permitted. switch (access_mode) {
case WASI_LIBC_ACCESS_MODE_READ_ONLY:
*rights_base &= ~(__wasi_rights_t)__WASI_RIGHT_FD_WRITE;
break;
case WASI_LIBC_ACCESS_MODE_WRITE_ONLY:
*rights_base &= ~(__wasi_rights_t)__WASI_RIGHT_FD_READ;
break;
}In my view, the access mode (fcntl() & O_ACCMODE) of STDIN and STDOUT should remain untouchable. Therefore, the rights of STDIN and STDOUT should also be constant. |
do you mean that wasi should be different from the most of posix platforms in the regard? why? |
…ook their access modes (#3694)"
This reverts commit 67fa155.
because it broke certain use cases while
it isn't clear what it fixed.
tested with:
https://github.com/yamt/garbage/tree/master/wasm/httpd
https://github.com/yamt/garbage/tree/master/wasm/tty
cf.
#4447
#3686 (comment)