[pacman-dev] [PATCH] NO_MSGSIGNAL and SIGPOLL don't exist on darwin

Andrew Gregory andrew.gregory.8 at gmail.com
Fri Sep 4 01:25:16 UTC 2020


On 09/01/20 at 03:50pm, Cameron Katri wrote:
> I believe I found a more portable solution. We use signal(SIGPIPE,
> SIG_IGN); which will block SIGPIPE, and if MSG_NOSIGNAL is not
> supported we set it to 0x0 so that it just gets ignored. Hopefully
> this is a more comprehensive solution.  
...
>  
> +	signal(SIGPIPE, SIG_IGN);

NACK. Signal handlers are process-wide and not something libraries
should be modifying without very good reason, especially not
conditionally and mid-operation.  The fact that gpgme ignores SIGPIPE
is what broke scripts and required us to start resetting signals.  The
whole point of using sockets was to selectively ignore SIGPIPE without
modifying the signal handler.

>  	nwrite = send(fd, buf, *buf_size, MSG_NOSIGNAL);
>  
>  	if(nwrite != -1) {
> @@ -557,8 +564,11 @@ static void _alpm_reset_signals(void)
>  	int *i, signals[] = {
>  		SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL,
>  		SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM, SIGTSTP,
> -		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
> +		SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPROF, SIGSYS, SIGTRAP,
>  		SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ,
> +#ifndef __APPLE__

Signal names are macros, test for SIGPOLL directly.

> +		SIGPOLL,
> +#endif


More information about the pacman-dev mailing list