Skip to content
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

build: panic when passing invalid path to tracy #20713

Closed
kubkon opened this issue Jul 21, 2024 · 0 comments · Fixed by #20779
Closed

build: panic when passing invalid path to tracy #20713

kubkon opened this issue Jul 21, 2024 · 0 comments · Fixed by #20779
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@kubkon
Copy link
Member

kubkon commented Jul 21, 2024

Zig Version

0.14.0-dev.423+79352635b

Steps to Reproduce and Observed Behavior

$ ./stage3/bin/zig build -p stage4 -Denable-llvm -Doptimize=ReleaseFast -Dstrip=false -Dtracy=/Users/kubkon/dev/tracy/public
thread 8778209 panic: index out of bounds: index 0, len 0
/Users/kubkon/dev/zig/lib/std/Build/Step.zig:549:103: 0x102fa726f in zigProcessUpdate (build)
                    const prefix_index: std.zig.Server.Message.PathPrefix = @enumFromInt(prefixed_path[0] - 1);
                                                                                                      ^
/Users/kubkon/dev/zig/lib/std/Build/Step.zig:441:40: 0x102fa992f in evalZigProcess (build)
    const result = try zigProcessUpdate(s, zp, watch);
                                       ^
/Users/kubkon/dev/zig/lib/std/Build/Step/Compile.zig:1752:54: 0x102f00c6f in make (build)
    const maybe_output_bin_path = step.evalZigProcess(
                                                     ^
/Users/kubkon/dev/zig/lib/std/Build/Step.zig:231:13: 0x102ed72d3 in make (build)
    s.makeFn(s, options) catch |err| switch (err) {
            ^
/Users/kubkon/dev/zig/lib/compiler/build_runner.zig:1046:31: 0x102e7dc9f in workerMakeOneStep (build)
    const make_result = s.make(.{
                              ^
/Users/kubkon/dev/zig/lib/std/Thread/Pool.zig:115:39: 0x102e7e5e7 in runFn (build)
            @call(.auto, func, closure.arguments);
                                      ^
/Users/kubkon/dev/zig/lib/std/Thread/Pool.zig:291:32: 0x102f49ecb in worker (build)
            run_node.data.runFn(&run_node.data, id);
                               ^
/Users/kubkon/dev/zig/lib/std/Thread.zig:409:13: 0x102ed5c3f in callFn__anon_16536 (build)
            @call(.auto, f, args);
            ^
/Users/kubkon/dev/zig/lib/std/Thread.zig:678:30: 0x102e7d2ab in entryFn (build)
                return callFn(f, args_ptr.*);
                             ^
???:?:?: 0x188892f93 in ??? (libsystem_pthread.dylib)
???:?:?: 0x261a80018888dd33 in ??? (???)
error: the following build command crashed:
/Users/kubkon/dev/zig/.zig-cache/o/5b4a0393f7f8ce18b6c3d95edfc42e9e/build /Users/kubkon/dev/zig/build/stage4/bin/zig /Users/kubkon/dev/zig/lib /Users/kubkon/dev/zig /Users/kubkon/dev/zig/.zig-cache /Users/kubkon/.cache/zig --seed 0x8241ce26 -Zc50781c420ca5a9d -p stage6 -Denable-llvm -Doptimize=ReleaseFast -Dstrip=false -Dtracy=/Users/kubkon/dev/tracy/public

Note I mistakenly explicitly included public subpath in tracy path which is not expected as build.zig will prepend that for us, however, it should still not panic.

Expected Behavior

A meaningful error.

@kubkon kubkon added the bug Observed behavior contradicts documented or intended behavior label Jul 21, 2024
@kubkon kubkon added this to the 0.14.0 milestone Jul 21, 2024
jacobly0 added a commit to jacobly0/zig that referenced this issue Jul 24, 2024
When all compiler inputs are invalid paths, there could be errors yet no
valid file system inputs.

Closes ziglang#20713
@jacobly0 jacobly0 added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Jul 24, 2024
SammyJames pushed a commit to SammyJames/zig that referenced this issue Aug 7, 2024
When all compiler inputs are invalid paths, there could be errors yet no
valid file system inputs.

Closes ziglang#20713
igor84 pushed a commit to igor84/zig that referenced this issue Aug 11, 2024
When all compiler inputs are invalid paths, there could be errors yet no
valid file system inputs.

Closes ziglang#20713
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants