-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.14.0-dev.2989+bf6ee7cb3
Steps to Reproduce and Observed Behavior
const std = @import("std");
pub fn main() void {
const term = "/usr/share/terminfo/78/xterm-256color";
std.debug.print(
"File {s} exists? {!}\n",
.{
term,
std.fs.accessAbsolute(term, .{ .mode = .read_write }),
},
);
}Here the file has only read permission for my user. accessAbsolute returns error.Unexpected and prints the stack trace:
$ zig run ~/tmp-code/exists.zig
unexpected errno: 1
/Users/giann/zig/master/lib/std/debug.zig:311:31: 0x100e41f87 in dumpCurrentStackTrace (exists)
writeCurrentStackTrace(stderr, debug_info, io.tty.detectConfig(io.getStdErr()), start_addr) catch |err| {
^
/Users/giann/zig/master/lib/std/posix.zig:7434:40: 0x100e571ab in unexpectedErrno (exists)
std.debug.dumpCurrentStackTrace(null);
^
/Users/giann/zig/master/lib/std/posix.zig:4949:45: 0x100e71293 in faccessatZ (exists)
else => |err| return unexpectedErrno(err),
^
/Users/giann/zig/master/lib/std/fs/Dir.zig:2481:36: 0x100e5492f in accessZ (exists)
const result = posix.faccessatZ(self.fd, sub_path, os_mode, 0);
^
/Users/giann/zig/master/lib/std/fs/Dir.zig:2464:24: 0x100e42cd7 in access (exists)
return self.accessZ(&path_c, flags);
^
/Users/giann/zig/master/lib/std/fs.zig:305:21: 0x100e414db in accessAbsolute (exists)
try cwd().access(absolute_path, flags);
^
/Users/giann/tmp-code/exists.zig:10:34: 0x100e40b4b in main (exists)
std.fs.accessAbsolute(term, .{ .mode = .read_write }),
^
/Users/giann/zig/master/lib/std/start.zig:647:22: 0x100e409a7 in main (exists)
root.main();
^
???:?:?: 0x189903fd7 in ??? (???)
???:?:?: 0xda197fffffffffff in ??? (???)
File /usr/share/terminfo/78/xterm-256color exists? error.Unexpected
Expected Behavior
Should not print the stack trace
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior