You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The final stage libc has several bugs in its handling of open() and fopen(). For starters:
The append modes are broken because open() ignores O_APPEND. It needs to seek to the end on open(), and it also needs to seek to the end on every write() (as specified by POSIX.) This will need to be coordinated with fwrite(), ftell() and so on (i.e. fwrite() must seek to the end even if it buffers the write.) See also VM issue with macOS related to the latest configure script #33.
The truncate syscall is supposed to be optional. We need a fallback to delete the file first if O_TRUNC is specified but truncate is not implemented.
The exclusive flag ('x') is parsed and ignored. It should either be implemented correctly or not supported at all. The O_EXCL flag is not implemented; it is required by POSIX.
The mode string parsing needs to be more restrictive. For example "r+" is valid but "+r" is not; Onramp currently accepts both.
There are probably more bugs. We need a robust set of tests to make sure all of these work. These can be written in C.
(This issue is also not covering the various other problems with the POSIX file API, for example the fact that child programs can close the file handles of their parents. We will need to proxy file syscalls to make them use the POSIX file APIs, and we will need to reference count handles; this will allow us to implement dup() and dup2(). This should probably be convered by a separate issue.)
The final stage libc has several bugs in its handling of
open()andfopen(). For starters:The append modes are broken because
open()ignoresO_APPEND. It needs to seek to the end onopen(), and it also needs to seek to the end on everywrite()(as specified by POSIX.) This will need to be coordinated withfwrite(),ftell()and so on (i.e.fwrite()must seek to the end even if it buffers the write.) See also VM issue with macOS related to the latest configure script #33.The truncate syscall is supposed to be optional. We need a fallback to delete the file first if
O_TRUNCis specified but truncate is not implemented.The exclusive flag ('x') is parsed and ignored. It should either be implemented correctly or not supported at all. The
O_EXCLflag is not implemented; it is required by POSIX.The mode string parsing needs to be more restrictive. For example "r+" is valid but "+r" is not; Onramp currently accepts both.
There are probably more bugs. We need a robust set of tests to make sure all of these work. These can be written in C.
(This issue is also not covering the various other problems with the POSIX file API, for example the fact that child programs can close the file handles of their parents. We will need to proxy file syscalls to make them use the POSIX file APIs, and we will need to reference count handles; this will allow us to implement
dup()anddup2(). This should probably be convered by a separate issue.)