Is it possible to change the file paths in the error traces so they don’t show absolute file paths on the system that built the binary? I am trying to include error traces in my release builds so when a user is screwed they can give me better debug info, and I dont think they need the path to the repo on my laptop
jeff@jeff-debian:~/repos/gatorcat$ sudo ./zig-out/bin/gatorcat --log-level warn run --ifname docker0
warning: Scheduler: NORMAL
error: Ping failed. No frame returned before the recv timeout. Is anything connected to the specified interface (docker0)?
error: NonRecoverable
/home/jeff/repos/gatorcat/src/module/Port.zig:297:9: 0x1794467 in sendRecvDatagram (gatorcat)
return error.RecvTimeout;
^
/home/jeff/repos/gatorcat/src/module/Port.zig:309:9: 0x1747160 in nop (gatorcat)
_ = try sendRecvDatagram(
^
/home/jeff/repos/gatorcat/src/module/Port.zig:269:5: 0x1746f86 in ping (gatorcat)
try self.nop(1, timeout_us);
^
/home/jeff/repos/gatorcat/src/cli/run.zig:96:17: 0x178c4e8 in run (gatorcat)
return error.NonRecoverable;
^
/home/jeff/repos/gatorcat/src/cli/main.zig:77:28: 0x178b722 in main (gatorcat)
.run => |run_args| try run.run(gpa.allocator(), run_args),
As a workaround you might be able to create a custom mountpoint at /zig and then use that.
So basically
sudo mkdir /zig
sudo mount --bind /home/user/myactualpath/zig /zig
Then maybe have a version directory that contains the zig versions and a projects directory?
/zig
version
0.14.0
zig
projects
gatorcat
(But if you only need the error return traces to be different, it might not matter from which path Zig is invoked)
I think with that setup your message would change to this:
jeff@jeff-debian:/zig/projects/gatorcat$ sudo ./zig-out/bin/gatorcat --log-level warn run --ifname docker0
warning: Scheduler: NORMAL
error: Ping failed. No frame returned before the recv timeout. Is anything connected to the specified interface (docker0)?
error: NonRecoverable
/zig/projects/gatorcat/src/module/Port.zig:297:9: 0x1794467 in sendRecvDatagram (gatorcat)
return error.RecvTimeout;
^
/zig/projects/gatorcat/src/module/Port.zig:309:9: 0x1747160 in nop (gatorcat)
_ = try sendRecvDatagram(
^
/zig/projects/gatorcat/src/module/Port.zig:269:5: 0x1746f86 in ping (gatorcat)
try self.nop(1, timeout_us);
^
/zig/projects/gatorcat/src/cli/run.zig:96:17: 0x178c4e8 in run (gatorcat)
return error.NonRecoverable;
^
/zig/projects/gatorcat/src/cli/main.zig:77:28: 0x178b722 in main (gatorcat)
.run => |run_args| try run.run(gpa.allocator(), run_args),
Maybe you also could shorten it to directly /gatorcat.