-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
SIGABRT in std.process.Child.run outside Debug mode #17704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Reproduced. If I change the allocator to a GeneralPurposeAllocator the problem goes away:
With the broken version, removing the 'defers' and print doesn't help. This still fails:
And |
I can't reproduce this anymore. I've been poking at this occasionally in the last several days to see if I can narrow the problem down, but after updating my tree and recompiling Zig, this no longer fails for me. I'm running I'm not so interested in this problem that I'll binary search what fixed it, though. So, if someone wants an excuse to learn how to |
Can confirm, this seems fixed. Will close the issue for now. |
Currently running const std = @import("std");
pub fn main() !void {
var alloc = std.heap.page_allocator;
const run_result = try std.process.Child.run(.{
.allocator = alloc,
.argv = &.{ "zig", "version" },
});
defer {
alloc.free(run_result.stderr);
alloc.free(run_result.stdout);
}
std.debug.print("{s}", .{run_result.stdout});
} The output is also extremely minimal, only showing this:
Runs totally fine in Debug and ReleaseSafe. Edit: test "Child.run" {
var alloc = std.heap.page_allocator;
const run_result = try std.process.Child.run(.{
.allocator = alloc,
.argv = &.{ "zig", "version" },
});
defer {
alloc.free(run_result.stderr);
alloc.free(run_result.stdout);
}
try std.testing.expectEqualStrings(
"0.14.0-dev.719+f21928657\n",
run_result.stdout,
);
}
Note that the test passes for all compilation options when using |
Interestingly, this fails with
I'll reopen this. |
#21756 looks similar (and like it might have some leads) |
Yep, looks like the same bug. I believe #21760 will fix this. |
Zig Version
0.12.0-dev.1245+a07f288eb
Steps to Reproduce and Observed Behavior
bug.zig
with the following content:zig run bug.zig
. This will build in debug mode and printhello
as expected.zig run bug.zig -OReleaseSafe
. This will result in the following runtime error:GDB reveals this stack trace:
Expected Behavior
The program runs the same in
Debug
andReleaseSafe
modes.The text was updated successfully, but these errors were encountered: