Skip to content

Progress panics in zig test when a terminal width is large. #13150

@naoki9911

Description

@naoki9911

Zig Version

0.10.0-dev.4327+3a9344d8f

Steps to Reproduce

Terminal width is larger than 256.

$ tput cols
382
const std = @import("std");

test "hello" {
}

Saving above code as main.zig and executing zig test main.zig.

Expected Behavior

zig test passes a test

$ zig test main.zig
All 1 tests passed

Actual Behavior

zig test crashes

$ zig test main.zig
Test [1/1] test.hello... thread 3130 panic: index out of bounds: index 264, len 256
/home/naoki/.local/zig-master/lib/std/Progress.zig:349:5: 0x23653f in refreshWithHeldLock (test)
    self.output_buffer_slice = self.output_buffer[unprintables .. unprintables + self.max_width.?];
    ^
/home/naoki/.local/zig-master/lib/std/Progress.zig:134:45: 0x21605a in end (test)
            self.context.refreshWithHeldLock();
                                            ^
/home/naoki/.local/zig-master/lib/test_runner.zig:83:18: 0x213f54 in main (test)
    root_node.end();
                 ^
/home/naoki/.local/zig-master/lib/std/start.zig:568:22: 0x212f6d in posixCallMainAndExit (test)
            root.main();
                     ^
/home/naoki/.local/zig-master/lib/std/start.zig:340:5: 0x212a32 in _start (test)
    @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
    ^
error: the following test command crashed:
/home/naoki/.cache/zig/o/cd5362779103cec731f993673b81c28e/test

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions