diff options
author | 2017-05-24 21:26:12 +0200 | |
---|---|---|
committer | 2017-05-26 09:35:21 +0200 | |
commit | a7c9a03611feca514b006eb81653923315031447 (patch) | |
tree | 42fcda6075077ee0d0716bbb2db65ff4021bb275 /src | |
parent | 08b86ec7ca06d5991042fece8f6dd5da155f51d3 (diff) |
process-tools: Fail silently when we can't install a signal handler.
linux-sandbox expects InstallSignalHandler to fail silently when called
for a signal that doesn't allow one to install a signal handler. This
behavior was accidentally lost and changed into a DIE() on sigaction
failure when unifying the signal handling code with process-wrapper in
https://github.com/bazelbuild/bazel/commit/f5900474b8bce417c3ef4c3e06af6da5ed57b929. This CL restores the previous behavior.
The issue results in this failure:
$ linux-sandbox -- /bin/true
third_party/bazel/src/main/tools/process-tools.cc:112: "sigaction": Invalid argument
We do have tests for linux-sandbox and Bazel's usage of the linux-sandbox
strategy. None of these actually started failing when the linux-sandbox
stopped working, due to our automatic fallback logic that we added in
order to not annoy users / CI on platforms that don't support the Linux
sandbox :( Bazel silently falls back to the processwrapper-sandbox
strategy and disables the entire linux-sandbox test suite, but signals
to CI that it passed (because we don't support a "Skipped" test status).
Well, congrats. What an epic fail. I will have to rework this next week.
PiperOrigin-RevId: 157021455
Diffstat (limited to 'src')
-rw-r--r-- | src/main/tools/process-tools.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/tools/process-tools.cc b/src/main/tools/process-tools.cc index ae3419a33a..7dd623fa76 100644 --- a/src/main/tools/process-tools.cc +++ b/src/main/tools/process-tools.cc @@ -108,8 +108,10 @@ void InstallSignalHandler(int signum, void (*handler)(int)) { DIE("sigfillset"); } } + // sigaction may fail for certain reserved signals. Ignore failure in this + // case, but report it in debug mode, just in case. if (sigaction(signum, &sa, nullptr) < 0) { - DIE("sigaction"); + PRINT_DEBUG("sigaction(%d, &sa, nullptr) failed", signum); } } |