Closed Reokodoku closed 2 months ago
Yeah, I noticed that too... I've tried a few things, and:
return error.InvalidConfig
with a panic it does work).getOptions
' call site (on main
) it does not panic.I'm starting to think it's a compiler bug, but I want to make sure before opening an issue there.
Maybe this happens when a try
fails.
For example if you do strace ./hevi --version
you get
[...]
write(2, "hevi ", 5hevi ) = 5
write(2, "1", 11) = 1
write(2, ".", 1.) = 1
write(2, "0", 10) = 1
write(2, ".", 1.) = 1
write(2, "0", 10) = 1
write(2, "-", 1-) = 1
write(2, "dev.52", 6dev.52) = 6
write(2, "+", 1+) = 1
write(2, "d975b28bdc", 10d975b28bdc) = 10
write(2, "\n", 1
) = 1
It writes to stderr like error.InvalidConfig
but here the write is successful. Same thing for strace ./hevi --help
Yeah, that's really weird... Specially the fact that the error code is EBADF (bad file descriptor)... Isn't FD 2 always available?
At this point this is for sure a compiler bug. Maybe we should open an issue over there.
Okay, so I found a close(2) syscall before the write(2, ...) syscall, and it was a pretty dumb mistake. https://github.com/Arnau478/hevi/blob/c6c30b876ce551aff20f0fa23177a5f63f9f9011/src/options.zig#L49
hevi version: 1.0.0-dev.52+d975b28bdc (latest commit) Zig version: 0.13.0-dev.75+5c9eb4081 OS: Linux
I don't know if it's my problem, zig's problem, or hevi's problem, but when I have an invalid JSON config file the program doesn't print anything.
But if I check with
strace ./hevi hevi
I can found thison Debug or
on Release*.
Affected builds (that I tried):
Config file: