bazelbuild / bazelbuild/bazelisk
bazelisk run/test hide segmentation violations
- Dominant language
- Go
- Stars
- 2.7k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
### Description of the bug:
`bazelisk run` hides segmentation violations, e.g. if "bazel run" returns with rc==139 "bazelisk run" will return with code 255 instead. Thus the shell also won't print the "segmentation violation" error.
Also see the discussion in the original ticket here for more details https://github.com/bazelbuild/bazel/issues/21470
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
main.cc
```
#include
using namespace std;
int main()
{
char* str;
// Stored in read only part of data segment //
str = "GfG";
// Problem: trying to modify read only memory //
*(str + 1) = 'n';
return 0;
}
```
BUILD
```
cc_binary(
name = "main",
srcs = ["main.cc"],
)
```
When we "bazelisk run" the cc_binary here's what we get (note on the screenshot bazel is an alias for bazelisk):


Running the binary from bazel-bin instead we clearly see the application segfaults (return code 139)

Contributor guide
Research direction
Start by reproducing the issue with `bazelisk run` and compare its exit status and shell output with running the binary from `bazel-bin`. Trace the `bazelisk run` and `bazelisk test` entry points where process termination status is handled. Done means signal-based failures preserve the segmentation-violation status and message instead of becoming exit code 255.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100