{"thread":{"id":"42193","subject":"pthread_sigmask() on windows (wine actualy)","startedAt":"2016-05-01T11:06:07Z","lastAt":"2016-05-03T04:48:46Z","messageCount":4,"participants":["Duy Nguyen","Jeff King","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"285071","messageId":"CACsJy8BrKsasiXZcc3=mm9Pq=qz_h6pi8edzpmT_7mKxwjnAqQ@mail.gmail.com","threadId":"42193","inReplyTo":null,"subject":"pthread_sigmask() on windows (wine actualy)","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-05-01T11:06:07Z","receivedAt":"2016-05-01T11:06:07Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"I got this while compiling master today using mingw32 cross toolchain\n\n    CC run-command.o\nrun-command.c: In function 'run_thread':\nrun-command.c:596:3: warning: implicit declaration of function\n'pthread_sigmask' [-Wimplicit-function-declaration]\nrun-command.c:596:23: error: 'SIG_BLOCK' undeclared (first use in this function)\nrun-command.c:596:23: note: each undeclared identifier is reported\nonly once for each function it appears in\n\nThis is added in c792d7b (run-command: teach async threads to ignore\nSIGPIPE - 2016-04-19). From the look of it, wrapping #ifndef\nGIT_WINDOWS_NATIVE is probably enough? I checked gfw/master too to see\nhow gfw deals with it, but the commit has not been merged there yet.\n-- \nDuy\n"},{"id":"285122","messageId":"20160501174535.GB17321@sigill.intra.peff.net","threadId":"42193","inReplyTo":"CACsJy8BrKsasiXZcc3=mm9Pq=qz_h6pi8edzpmT_7mKxwjnAqQ@mail.gmail.com","subject":"Re: pthread_sigmask() on windows (wine actualy)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-01T17:45:36Z","receivedAt":"2016-05-01T17:45:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, May 01, 2016 at 06:06:07PM +0700, Duy Nguyen wrote:\n\n> I got this while compiling master today using mingw32 cross toolchain\n> \n>     CC run-command.o\n> run-command.c: In function 'run_thread':\n> run-command.c:596:3: warning: implicit declaration of function\n> 'pthread_sigmask' [-Wimplicit-function-declaration]\n> run-command.c:596:23: error: 'SIG_BLOCK' undeclared (first use in this function)\n> run-command.c:596:23: note: each undeclared identifier is reported\n> only once for each function it appears in\n> \n> This is added in c792d7b (run-command: teach async threads to ignore\n> SIGPIPE - 2016-04-19). From the look of it, wrapping #ifndef\n> GIT_WINDOWS_NATIVE is probably enough? I checked gfw/master too to see\n> how gfw deals with it, but the commit has not been merged there yet.\n\nI think the fix should go into compat/. See\n\n  http://git.661346.n2.nabble.com/PATCH-0-5-fix-deadlock-in-git-push-tp7653666p7653818.html\n\n(sorry, gmane seems down).\n\n-Peff\n"},{"id":"285130","messageId":"57265425.9050205@kdbg.org","threadId":"42193","inReplyTo":"20160501174535.GB17321@sigill.intra.peff.net","subject":"[PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-05-01T19:08:21Z","receivedAt":"2016-05-01T19:08:21Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"A previous change introduced a call to pthread_sigmask() in order to block\nSIGPIPE in a thread. Since there are no signal facilities on Windows that\nare similar to POSIX signals, just ignore the request to block the signal.\nIn the particular case, the effect of blocking SIGPIPE on POSIX is that\nwrite() calls return EPIPE when the reader closes the pipe. This is how\nwrite() behaves on Windows.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n compat/mingw.h         | 1 +\n compat/win32/pthread.h | 5 +++++\n 2 files changed, 6 insertions(+)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex a950ae2..0f272fd 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -142,6 +142,7 @@ static inline int fcntl(int fd, int cmd, ...)\n #define sigemptyset(x) (void)0\n static inline int sigaddset(sigset_t *set, int signum)\n { return 0; }\n+#define SIG_BLOCK 0\n #define SIG_UNBLOCK 0\n static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)\n { return 0; }\ndiff --git a/compat/win32/pthread.h b/compat/win32/pthread.h\nindex b6ed9e7..d336451 100644\n--- a/compat/win32/pthread.h\n+++ b/compat/win32/pthread.h\n@@ -104,4 +104,9 @@ static inline void *pthread_getspecific(pthread_key_t key)\n \treturn TlsGetValue(key);\n }\n \n+static inline int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)\n+{\n+\treturn 0;\n+}\n+\n #endif /* PTHREAD_H */\n-- \n2.7.0.118.g90056ae\n"},{"id":"285246","messageId":"20160503044845.GC32259@sigill.intra.peff.net","threadId":"42193","inReplyTo":"57265425.9050205@kdbg.org","subject":"Re: [PATCH jk/push-client-deadlock-fix] Windows: add pthread_sigmask() that does nothing","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-05-03T04:48:46Z","receivedAt":"2016-05-03T04:48:46Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, May 01, 2016 at 09:08:21PM +0200, Johannes Sixt wrote:\n\n> A previous change introduced a call to pthread_sigmask() in order to block\n> SIGPIPE in a thread. Since there are no signal facilities on Windows that\n> are similar to POSIX signals, just ignore the request to block the signal.\n> In the particular case, the effect of blocking SIGPIPE on POSIX is that\n> write() calls return EPIPE when the reader closes the pipe. This is how\n> write() behaves on Windows.\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n\nLooks good to me based on our earlier discussion (but of course I have\nno platform to test it on).\n\n-Peff\n"}]}