Open marcs-feh opened 6 months ago
Is read
returning 0 into n
?
Obligatory os2 isn't ready for use yet + only really tested on Windows.
This is an infinite loop on unix because read
returns 0 bytes when at eof on Unix, while on Windows it actually returns an error saying it is eof.
So to fix it would need to check if n == 0
and return.
We also need to make the behaviour the same across OSes too for this. So that it will work.
Context
odin report
Expected Behavior
read_entire_file
should simply read the whole file into a buffer allocated with a particular allocator.Current Behavior
An infinite loop is created when reading a file, the issue seems to be in![image](https://github.com/odin-lang/Odin/assets/82233333/2bbb4924-78c4-4f83-8932-6ad8fa4daec4)
core/os/os2/file_util.odin
in the procedureread_entire_file_from_file
. Running it on a debugger shows the bug happens during the reading loop:Steps to Reproduce
Example bug.odin