From 647dc1afc5932b0dbbc409727cc81def8e90a0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 29 Aug 2019 15:19:44 +0000 Subject: [PATCH] Revert "runtime: don't forward SIGPIPE on macOS" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts CL 188297. Reason for revert: broke multiple of the darwin builders. Fixes #33943. Change-Id: Iacff98d1450edc70402dc7a220d16fcd73337c9e Reviewed-on: https://go-review.googlesource.com/c/go/+/191784 Run-TryBot: Daniel Martí Reviewed-by: Bryan C. Mills --- misc/cgo/testcarchive/testdata/main3.c | 21 --------------------- src/runtime/signal_unix.go | 7 ------- 2 files changed, 28 deletions(-) diff --git a/misc/cgo/testcarchive/testdata/main3.c b/misc/cgo/testcarchive/testdata/main3.c index 4d11d9ce4c3..60a16cf5fc4 100644 --- a/misc/cgo/testcarchive/testdata/main3.c +++ b/misc/cgo/testcarchive/testdata/main3.c @@ -12,7 +12,6 @@ #include #include #include -#include #include "libgo3.h" @@ -52,18 +51,11 @@ static void init() { } } -static void *provokeSIGPIPE(void *arg) { - ProvokeSIGPIPE(); - return NULL; -} - int main(int argc, char** argv) { int verbose; struct sigaction sa; int i; struct timespec ts; - int res; - pthread_t tid; verbose = argc > 2; setvbuf(stdout, NULL, _IONBF, 0); @@ -76,19 +68,6 @@ int main(int argc, char** argv) { // a non-default SIGPIPE handler before the runtime initializes. ProvokeSIGPIPE(); - // Test that SIGPIPE on a non-main thread is also handled by Go. - res = pthread_create(&tid, NULL, provokeSIGPIPE, NULL); - if (res != 0) { - fprintf(stderr, "pthread_create: %s\n", strerror(res)); - exit(EXIT_FAILURE); - } - - res = pthread_join(tid, NULL); - if (res != 0) { - fprintf(stderr, "pthread_join: %s\n", strerror(res)); - exit(EXIT_FAILURE); - } - if (verbose) { printf("calling sigaction\n"); } diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 436c18c1261..ad51dc1800f 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -636,13 +636,6 @@ func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool { return true } - // This function and its caller sigtrampgo assumes SIGPIPE is delivered on the - // originating thread. This property does not hold on macOS (golang.org/issue/33384), - // so we have no choice but to ignore SIGPIPE. - if GOOS == "darwin" && sig == _SIGPIPE { - return true - } - // If there is no handler to forward to, no need to forward. if fwdFn == _SIG_DFL { return false