zig-args icon indicating copy to clipboard operation
zig-args copied to clipboard

core dump running demo_verb

Open AvdN opened this issue 3 years ago • 1 comments
trafficstars

You get a core-dump if you run the demo_verb example program and only provide a verb and the error message "Short command line options are not supported", doesn't make much sense in that context:

$ /demo_verb foo                                                                                   
Short command line options are not supported.
executable name: ./demo_verb
thread 152356 panic: attempt to use null value
/data1/DOWNLOAD/zig/zig-args/demo_verb.zig:39:25: 0x22f042 in main (demo_verb)
    switch (options.verb.?) {
                        ^
/opt/zig/zig-linux-x86_64-0.10.0-dev.580+53e6c719e/lib/std/start.zig:561:37: 0x228481 in std.start.callMain (demo_verb)
            const result = root.main() catch |err| {
                                    ^
/opt/zig/zig-linux-x86_64-0.10.0-dev.580+53e6c719e/lib/std/start.zig:495:12: 0x20905e in std.start.callMainWithArgs (demo_verb)
    return @call(.{ .modifier = .always_inline }, callMain, .{});
           ^
/opt/zig/zig-linux-x86_64-0.10.0-dev.580+53e6c719e/lib/std/start.zig:409:17: 0x2080f6 in std.start.posixCallMainAndExit (demo_verb)
    std.os.exit(@call(.{ .modifier = .always_inline }, callMainWithArgs, .{ argc, argv, envp }));
                ^
/opt/zig/zig-linux-x86_64-0.10.0-dev.580+53e6c719e/lib/std/start.zig:322:5: 0x207f02 in std.start._start (demo_verb)
    @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
    ^
[1]    152356 abort (core dumped)  ./demo_verb foo

When providing an option, the core dump doesn't happen (but the error message still doesn't make much sense)

AvdN avatar Feb 07 '22 13:02 AvdN

Huh. This definitly needs to be fixed. I'll check it out when i got the time

ikskuh avatar Feb 07 '22 13:02 ikskuh