Skip to content

Conversation

imomaliev
Copy link
Contributor

@imomaliev imomaliev commented Sep 8, 2025

test/standalone/simple/cat/main.zig panics on run in version 0.15.1, but in 0.14.1 it works properly

/.../zig/std/debug.zig:559:14: 0x102e0fe07 in assert (...)
    if (!ok) unreachable; // assertion failure
             ^
/.../zig/0.15.1/lib/zig/std/Io/Writer.zig:939:11: 0x102ea2bb7 in sendFileAll (...)
    assert(w.buffer.len > 0);
          ^
/.../src/main.zig:35:39: 0x102ea28df in main (..)
            _ = try stdout.sendFileAll(&file_reader, .unlimited);
                                      ^

Steps to reproduce

$ zig init
# replace contents of src/main.zig with test/standalone/simple/cat/main.zig
$ zig build
$ echo "test" > t.txt
$ ./zig-out/bin/cat t.txt

I was not sure if the code in simple/cat should be actually working or only buildable, but this PR makes it work again

JFYI I did start discussion in ziggit, but decided to push fix to upstream at the end

- Fixes:
    zig/0.15.1/lib/zig/std/Io/Writer.zig:939:11: 0x1049aef63 in sendFileAll (nclip)
        assert(w.buffer.len > 0);
- because we are no using non zero buffers for stdout - "do not forget to flush"
@alexrp
Copy link
Member

alexrp commented Sep 8, 2025

I wonder why we're apparently not building this test in CI? That seems unintentional.

@imomaliev
Copy link
Contributor Author

@alexrp Hi! It works on build, it fails when trying to run the program. Maybe I was searching wrong, but I did not find anything in tests that actually checks if the program is runnable

@andrewrk
Copy link
Member

andrewrk commented Sep 8, 2025

Looks good, thank you!

@andrewrk andrewrk enabled auto-merge (squash) September 8, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants