zig
zig copied to clipboard
Introduce ChildProcess.collectOutput
All the code for this function already exists, but only ChildProcess.exec was allowed to use the code.
The CI fails on x86_64 zig test runner at
stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Denable-llvm
+ stage3/bin/zig build test-universal-libc -fqemu -fwasmtime -Denable-llvm
warning: config.h could not be located automatically. Consider providing it explicitly via "-Dconfig_h"
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
1/7 test.memcmp... OK
2/7 test.bcmp... OK
3/7 test.strcpy... OK
4/7 test.strncpy... OK
5/7 test.strcat... OK
6/7 test.strncat... OK
7/7 test.strncmp... OK
All 7 tests passed.
+ stage3/bin/zig build test-compare-output -fqemu -fwasmtime -Denable-llvm
warning: config.h could not be located automatically. Consider providing it explicitly via "-Dconfig_h"
thread 77137 panic: reached unreachable code
Analyzing /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
%384 = ref(%262)
%385 = field_ptr(%384, "child_allocator")
%386 = field_call_bind(%385, "resize")
%387 = dbg_stmt(21, 56)
%388 = param_type(%386, 0)
%389 = load(%279)
%390 = field_val(%389, "data")
%391 = param_type(%386, 1)
> %392 = call(.auto, %386, [%390, %380])
%393 = is_non_null(%392)
%394 = condbr(%393, {
%396 = optional_payload_unsafe(%392)
%397 = store_node(%383, %396)
%415 = break(%395, @Zir.Inst.Ref.void_value)
}, {
%398 = dbg_block_begin())
%399 = dbg_stmt(23, 17)
%400 = ref(%262)
%401 = field_call_bind(%400, "createNode")
%402 = dbg_stmt(23, 47)
%403 = param_type(%401, 0)
%404 = field_val(%323, "len")
%405 = param_type(%401, 1)
%406 = add(%264, %266)
%407 = call(.auto, %401, [%404, %406])
%408 = try(%407, {
%409 = err_union_code(%407)
%410 = ret_node(%409)
})
%411 = store_node(%279, %408)
%412 = dbg_stmt(24, 17)
%414 = dbg_block_end())
%413 = break(%314, @Zir.Inst.Ref.void_value)
})
For full context, use the command
zig ast-check -t /workspace/stage3/lib/zig/std/heap/arena_allocator.zig
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %395 = block({%384..%394})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %313 = condbr(@Zir.Inst.Ref.bool_true, {%317..%418}, {%419})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %314 = block({%312, %313})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %311 = loop({%314, %316})
in /workspace/stage3/lib/zig/std/mem/Allocator.zig: mem/Allocator.zig:init__anon_4298
> %154 = param_comptime("allocFn", {%135, %153})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.allocator
> %85 = call(.auto, %76, [%69, %80, %82, %84])
???:?:?: 0x7419a36 in ??? (???)
???:?:?: 0x76f2e0e in ??? (???)
???:?:?: 0x74bc9ff in ??? (???)
???:?:?: 0x8329031 in ??? (???)
???:?:?: 0x83296cc in ??? (???)
???:?:?: 0x8245474 in ??? (???)
???:?:?: 0x80c96a0 in ??? (???)
???:?:?: 0x7efa672 in ??? (???)
???:?:?: 0x7d6b7ad in ??? (???)
???:?:?: 0x7b532d1 in ??? (???)
???:?:?: 0x79eaf17 in ??? (???)
???:?:?: 0x7d993d2 in ??? (???)
???:?:?: 0x7bd8bcf in ??? (???)
???:?:?: 0x79f8ba8 in ??? (???)
???:?:?: 0x7bdab7b in ??? (???)
???:?:?: 0x79fa0ea in ??? (???)
???:?:?: 0x7d993d2 in ??? (???)
???:?:?: 0x7bd8bcf in ??? (???)
???:?:?: 0x79f8ba8 in ??? (???)
???:?:?: 0x79e97eb in ??? (???)
???:?:?: 0x7bd8126 in ??? (???)
???:?:?: 0x79f8688 in ??? (???)
???:?:?: 0x79e97eb in ??? (???)
???:?:?: 0x7893766 in ??? (???)
???:?:?: 0x76f0332 in ??? (???)
???:?:?: 0x7e3ba7f in ??? (???)
???:?:?: 0x7c7dc3e in ??? (???)
???:?:?: 0x7c7ccf4 in ??? (???)
???:?:?: 0x7c83811 in ??? (???)
???:?:?: 0x7c836e5 in ??? (???)
???:?:?: 0x7e37187 in ??? (???)
???:?:?: 0x7c83329 in ??? (???)
???:?:?: 0x7a1ca39 in ??? (???)
???:?:?: 0x78998af in ??? (???)
???:?:?: 0x7bd533d in ??? (???)
???:?:?: 0x79f75ef in ??? (???)
???:?:?: 0x78a2795 in ??? (???)
???:?:?: 0x7d68645 in ??? (???)
???:?:?: 0x7efca32 in ??? (???)
???:?:?: 0x7d6b7ad in ??? (???)
???:?:?: 0x7b532d1 in ??? (???)
???:?:?: 0x79eaf17 in ??? (???)
???:?:?: 0x79e97eb in ??? (???)
???:?:?: 0x7893766 in ??? (???)
???:?:?: 0x76f0332 in ??? (???)
???:?:?: 0x76eec4a in ??? (???)
???:?:?: 0x76102b0 in ??? (???)
???:?:?: 0x760d36e in ??? (???)
???:?:?: 0x7631d19 in ??? (???)
???:?:?: 0x743b1c4 in ??? (???)
???:?:?: 0x7417e35 in ??? (???)
???:?:?: 0x7417733 in ??? (???)
???:?:?: 0x7419035 in ??? (???)
???:?:?: 0x8509b6b in ??? (???)
error: test...
error: The following command terminated unexpectedly:
/workspace/stage3/bin/zig build-exe zig-cache/o/_hJ4NXK-Ffa00GrSqu-5nG8AAwI1rrycGtVWhC6wXQsnRkTwZ3M1LD135QOCGRoq/source.zig --cache-dir /workspace/zig-cache --global-cache-dir /root/.cache/zig --name test --enable-cache
error: the following build command failed with exit code 6:
/workspace/zig-cache/o/053668d9d647c631be163e910ac6ee20/build /workspace/stage3/bin/zig /workspace /workspace/zig-cache /root/.cache/zig test-compare-output -fqemu -fwasmtime -Denable-llvm
PR looking good, though this time this fails:
+ stage3/bin/zig build test-link -fqemu -fwasmtime -Denable-llvm
warning: config.h could not be located automatically. Consider providing it explicitly via "-Dconfig_h"
thread 113422 panic: reached unreachable code
Analyzing /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
+ stage3/bin/zig build test-link -fqemu -fwasmtime -Denable-llvm
warning: config.h could not be located automatically. Consider providing it explicitly via "-Dconfig_h"
thread 113422 panic: reached unreachable code
Analyzing /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
%384 = ref(%262)
%385 = field_ptr(%384, "child_allocator")
%386 = field_call_bind(%385, "resize")
%387 = dbg_stmt(21, 56)
%388 = param_type(%386, 0)
%389 = load(%279)
%390 = field_val(%389, "data")
%391 = param_type(%386, 1)
> %392 = call(.auto, %386, [%390, %380])
%393 = is_non_null(%392)
%394 = condbr(%393, {
%396 = optional_payload_unsafe(%392)
%397 = store_node(%383, %396)
%415 = break(%395, @Zir.Inst.Ref.void_value)
}, {
%398 = dbg_block_begin())
%399 = dbg_stmt(23, 17)
%400 = ref(%262)
%401 = field_call_bind(%400, "createNode")
%402 = dbg_stmt(23, 47)
%403 = param_type(%401, 0)
%404 = field_val(%323, "len")
%405 = param_type(%401, 1)
%406 = add(%264, %266)
%407 = call(.auto, %401, [%404, %406])
%408 = try(%407, {
%409 = err_union_code(%407)
%410 = ret_node(%409)
})
%411 = store_node(%279, %408)
%412 = dbg_stmt(24, 17)
%414 = dbg_block_end())
%413 = break(%314, @Zir.Inst.Ref.void_value)
})
For full context, use the command
zig ast-check -t /workspace/stage3/lib/zig/std/heap/arena_allocator.zig
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %395 = block({%384..%394})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %313 = condbr(@Zir.Inst.Ref.bool_true, {%317..%418}, {%419})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %314 = block({%312, %313})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.alloc
> %311 = loop({%314, %316})
in /workspace/stage3/lib/zig/std/mem/Allocator.zig: mem/Allocator.zig:init__anon_6214
> %154 = param_comptime("allocFn", {%135, %153})
in /workspace/stage3/lib/zig/std/heap/arena_allocator.zig: heap/arena_allocator.zig:ArenaAllocator.allocator
> %85 = call(.auto, %76, [%69, %80, %82, %84])
???:?:?: 0x7419a06 in ??? (???)
???:?:?: 0x76f2efe in ??? (???)
???:?:?: 0x74bc9cf in ??? (???)
???:?:?: 0x8329931 in ??? (???)
???:?:?: 0x8329fcc in ??? (???)
???:?:?: 0x8245d74 in ??? (???)
???:?:?: 0x80c9ef0 in ??? (???)
???:?:?: 0x7efa922 in ??? (???)
???:?:?: 0x7d6b95d in ??? (???)
???:?:?: 0x7b53481 in ??? (???)
???:?:?: 0x79eb0c7 in ??? (???)
???:?:?: 0x7d99582 in ??? (???)
???:?:?: 0x7bd8d7f in ??? (???)
???:?:?: 0x79f8d58 in ??? (???)
???:?:?: 0x7bdad2b in ??? (???)
???:?:?: 0x79fa29a in ??? (???)
???:?:?: 0x7d99582 in ??? (???)
???:?:?: 0x7bd8d7f in ??? (???)
???:?:?: 0x79f8d58 in ??? (???)
???:?:?: 0x79e999b in ??? (???)
???:?:?: 0x7bd82d6 in ??? (???)
???:?:?: 0x79f8838 in ??? (???)
???:?:?: 0x79e999b in ??? (???)
???:?:?: 0x78938d6 in ??? (???)
???:?:?: 0x76f0422 in ??? (???)
???:?:?: 0x7e3bc2f in ??? (???)
???:?:?: 0x7c7ddee in ??? (???)
???:?:?: 0x7c7cea4 in ??? (???)
???:?:?: 0x7c839c1 in ??? (???)
???:?:?: 0x7c83895 in ??? (???)
???:?:?: 0x7e37337 in ??? (???)
???:?:?: 0x7c834d9 in ??? (???)
???:?:?: 0x7a1cbe9 in ??? (???)
???:?:?: 0x7899a1f in ??? (???)
???:?:?: 0x7bd54ed in ??? (???)
???:?:?: 0x79f779f in ??? (???)
???:?:?: 0x78a2905 in ??? (???)
???:?:?: 0x7d687f5 in ??? (???)
???:?:?: 0x7efcce2 in ??? (???)
???:?:?: 0x7d6b95d in ??? (???)
???:?:?: 0x7b53481 in ??? (???)
???:?:?: 0x79eb0c7 in ??? (???)
???:?:?: 0x79e999b in ??? (???)
???:?:?: 0x78938d6 in ??? (???)
???:?:?: 0x76f0422 in ??? (???)
???:?:?: 0x76eed3a in ??? (???)
???:?:?: 0x7610280 in ??? (???)
???:?:?: 0x760d33e in ??? (???)
???:?:?: 0x7631ce9 in ??? (???)
???:?:?: 0x743b194 in ??? (???)
???:?:?: 0x7417e05 in ??? (???)
???:?:?: 0x7417703 in ??? (???)
???:?:?: 0x7419005 in ??? (???)
???:?:?: 0x850a78b in ??? (???)
error: bss...
error: The following command terminated unexpectedly:
/workspace/stage3/bin/zig build-exe /workspace/test/link/bss/main.zig --cache-dir /workspace/test/link/bss/zig-cache --global-cache-dir /root/.cache/zig --name bss --enable-cache
error: the following build command failed with exit code 6:
/workspace/test/link/bss/zig-cache/o/97dfe040e33715d9081f64a9d077a4b1/build /workspace/stage3/bin/zig /workspace/test/link/bss /workspace/test/link/bss/zig-cache /root/.cache/zig test
The following command exited with error code 1 (expected 0):
cd /workspace && stage3/bin/zig build --build-file /workspace/test/link/bss/build.zig test
error: UnexpectedExitCode
/workspace/stage3/lib/zig/std/child_process.zig:1300:5: 0x3573a1 in createNullDelimitedEnvMap (build)
return envp_buf;
^
/workspace/stage3/lib/zig/std/os.zig:3794:18: 0x357c0b in eventfd (build)
switch (errno(rc)) {
^
/workspace/stage3/lib/zig/std/os.zig:4313:18: 0x357d95 in fork (build)
switch (errno(rc)) {
^
/workspace/stage3/lib/zig/std/child_process.zig:455:9: 0x307f2a in waitPosix (build)
return self.term.?;
^
/workspace/stage3/lib/zig/std/build/RunStep.zig:235:49: 0x343727 in runCommand (build)
defer if (stdout) |s| builder.allocator.free(s);
^
/workspace/stage3/lib/zig/std/build/RunStep.zig:183:19: 0x323bc0 in make (build)
try runCommand(
^
/workspace/stage3/lib/zig/std/build.zig:3648:24: 0x2e6997 in make (build)
try self.makeFn(self);
^
/workspace/stage3/lib/zig/std/build.zig:508:19: 0x2c778a in makeOneStep (build)
try s.make();
^
/workspace/stage3/lib/zig/std/build.zig:502:17: 0x2c7702 in makeOneStep (build)
return err;
^
/workspace/stage3/lib/zig/std/build.zig:502:17: 0x2c7702 in makeOneStep (build)
return err;
^
/workspace/stage3/lib/zig/std/build.zig:451:34: 0x2c7468 in make (build)
defer wanted_steps.deinit();
^
/workspace/stage3/lib/zig/build_runner.zig:17:23: 0x2c9fcc in main (build)
defer arena.deinit();
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:323:9: 0x396f23 in allocAdvancedWithRetAddr__anon_46923 (build)
return @intToPtr([*]T, @ptrToInt(byte_slice.ptr))[0..@divExact(byte_slice.len, @sizeOf(T))];
^
/workspace/stage3/lib/zig/std/mem/Allocator.zig:233:9: 0x3777c0 in allocWithOptionsRetAddr__anon_43874 (build)
return ptr[0..n :sentinel];
^
error: the following build command failed with exit code 1:
/workspace/zig-cache/o/300568de872f728073683f42b5a52821/build /workspace/stage3/bin/zig /workspace /workspace/zig-cache /root/.cache/zig test-link -fqemu -fwasmtime -Denable-llvm