-
-
Notifications
You must be signed in to change notification settings - Fork 798
Closed
Labels
Description
Context
odin report
Odin: dev-2024-03:04f0fbf23
OS: Arch Linux, Linux 6.6.21-1-lts
CPU: Intel(R) Celeron(R) N4020 CPU @ 1.10GHz
RAM: 3471 MiB
Backend: LLVM 17.0.5
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 core/os/os2/file_util.odin
in the procedure read_entire_file_from_file
. Running it on a debugger shows the bug happens during the reading loop:
Steps to Reproduce
Example bug.odin
package bug
import "core:fmt"
import os "core:os/os2"
main :: proc(){
f, err := os.read_entire_file("foo.txt", context.allocator)
fmt.println("Error:", err)
fmt.println("File data:", f)
}
echo 'Hellope' > foo.txt
odin build bug.odin -file
./bug