Subject: Re: bug#54245: 29.0.50; select usage in GNUstep

From: Po Lu <[email-masked]>
Date: Sat, 05 Mar 2022 08:45:03 +0800

Robert Pluim <[email-masked]> writes:

> Iʼve been running with the following for a whole two days with no ill
> effects (and the resulting emacs binary does not contain any calls to
> 'select'). Last time I looked, emacs never seems to use the sigmask
> parameter to 'pselect' anyway, so itʼs kind of a moot point.
>
> diff --git a/src/nsterm.m b/src/nsterm.m
> index 670f8971df..4eb32de654 100644
> --- a/src/nsterm.m
> +++ b/src/nsterm.m
> @@ -5830,7 +5830,7 @@ - (void)fd_handler:(id)unused
>            fd_set fds;
>            FD_ZERO (&fds);
>            FD_SET (selfds[0], &fds);
> -          result = select (selfds[0]+1, &fds, NULL, NULL, NULL);
> +          result = pselect (selfds[0]+1, &fds, NULL, NULL, NULL, NULL);
>            if (result > 0 && read (selfds[0], &c, 1) == 1 && c == 'g')
>  	    waiting = 0;
>          }
>
> Robert

That LGTM, but I only tested on GNUstep.  The same code is also used on
macOS, so there might be some side effects.

Though the NS port is very old and I get the feeling that we keep
bumping into relics from over two decades ago, and using `select' might
very well be one of those.

Thanks.