-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Hi,
Running macOS Catalina and zig 0.5.0+5874cb04b.
On macOS Catalina, When calling f.write() on a file opened with File.openRead(), zig panics on EBADF, which in has a comment saying "always a race condition" and does not return an error. This is a single-threaded program. EBADF seems to be the proper error for writing to a file open for reading and is not a race condition:
[EBADF] fildes is not a valid file descriptor open for writing.
This seems to be related to this bug but not 100% sure.
Here is the error trace:
reached unreachable code
lib/zig/std/os.zig:497:22: 0x105207854 in _std.os.write
EBADF => unreachable, // Always a race condition.
^
lib/zig/std/fs/file.zig:296:24: 0x105203992 in _std.fs.file.File.write
return os.write(self.handle, bytes);
^
prog.zig:48:16: 0x105210cc3 in _main.0
f.write(bytes[0..])
^
Please let me know if you need anything else from me
Metadata
Metadata
Assignees
Labels
breakingImplementing this issue could cause existing code to no longer compile or have different behavior.Implementing this issue could cause existing code to no longer compile or have different behavior.bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.