Skip to content

Inconsistent and mostly undocumented default exit codes #1225

Open
@haasn

Description

@haasn

Turns out my CI was completely ignoring msan failures for the longest time because an exit code of 77 (msan's default exitcode) is interpreted as "skip this test" in the GNU testing protocol (used by meson etc.).

I found it essentially entirely impossible to figure out this fact from the documentation alone, I was only able to find SanitizerCommonFlags which claims that exitcode defaults to 1, as well as various other bits of documentation that don't even mention the exit code.

But looking at the source code of rt-lib, the actual behavior of the exit code seems a bit sporadic:

  • msan defaults to 77 (msan/msan.cpp)
  • asan defaults to 1 (asan/asan_flags.cpp)
  • ubsan is hard-coded to Die() (which implies exit(1)), and ignores cf.exitcode entirely!
  • tsan defaults to 66 (tsan/rtl/tsan_flags.cpp)
  • lsan defaults to 23 (lsan/lsan.cpp)
  • hwasan defaults to 99 (hwasan/hwasan.cpp)
  • scudo defaults to 1 (scudo/scudo_flags.cpp)
  • ...

Quite frankly this needs to be documented more clearly at least somewhere, so that users aren't left grepping the source code to figure out what tools exit with what status codes and how to change them.

As a side note, exiting with 77 definitely should be changed for the reason mentioned, although rather than setting it to something else absurd like 55, I think the behavior and default should be consistent across all of these tools.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions