* bug#54245: 29.0.50; select usage in GNUstep
@ 2022-03-04 15:30 Lars Ingebrigtsen
2022-03-04 16:10 ` Lars Ingebrigtsen
2022-03-04 16:15 ` Robert Pluim
0 siblings, 2 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-04 15:30 UTC (permalink / raw)
To: 54245
Paul noted in bug#32452 that:
---
I notice that Emacs's GNUstep code calls 'select'. For completeness this
should be 'pselect' instead, so that Emacs never calls 'select'.
---
So that should be fixed. (I open a new bug report, because that bug
report was already way too long.)
In GNU Emacs 29.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.16.0)
of 2022-02-25 built on giant
Repository revision: ca3858563c7ba8ee3caa82fbd2b7c386ea60c0d3
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Debian GNU/Linux bookworm/sid
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54245: 29.0.50; select usage in GNUstep
2022-03-04 15:30 bug#54245: 29.0.50; select usage in GNUstep Lars Ingebrigtsen
@ 2022-03-04 16:10 ` Lars Ingebrigtsen
2022-03-04 16:15 ` Robert Pluim
1 sibling, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-04 16:10 UTC (permalink / raw)
To: 54245; +Cc: Alan Third
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Paul noted in bug#32452 that:
>
> ---
> I notice that Emacs's GNUstep code calls 'select'. For completeness this
> should be 'pselect' instead, so that Emacs never calls 'select'.
> ---
I guess it's this code:
- (void)fd_handler:(id)unused
/* --------------------------------------------------------------------------
Check data waiting on file descriptors and terminate if so.
-------------------------------------------------------------------------- */
{
[...]
result = select (selfds[0]+1, &fds, NULL, NULL, NULL);
if (result > 0 && read (selfds[0], &c, 1) == 1 && c == 'g')
waiting = 0;
nsterm.m uses pselect throughout otherwise, so I guess changing this to
pselect should be unproblematic, too? Perhaps Alan has some comments;
added to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54245: 29.0.50; select usage in GNUstep
2022-03-04 15:30 bug#54245: 29.0.50; select usage in GNUstep Lars Ingebrigtsen
2022-03-04 16:10 ` Lars Ingebrigtsen
@ 2022-03-04 16:15 ` Robert Pluim
2022-03-05 0:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2022-03-04 16:15 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 54245
>>>>> On Fri, 04 Mar 2022 16:30:38 +0100, Lars Ingebrigtsen <larsi@gnus.org> said:
Lars> Paul noted in bug#32452 that:
Lars> ---
Lars> I notice that Emacs's GNUstep code calls 'select'. For completeness this
Lars> should be 'pselect' instead, so that Emacs never calls 'select'.
Lars> ---
Lars> So that should be fixed. (I open a new bug report, because that bug
Lars> report was already way too long.)
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
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#54245: 29.0.50; select usage in GNUstep
2022-03-04 16:15 ` Robert Pluim
@ 2022-03-05 0:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05 11:32 ` Robert Pluim
0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-03-05 0:45 UTC (permalink / raw)
To: Robert Pluim; +Cc: Lars Ingebrigtsen, 54245
Robert Pluim <rpluim@gmail.com> 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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54245: 29.0.50; select usage in GNUstep
2022-03-05 0:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-03-05 11:32 ` Robert Pluim
2022-03-05 19:00 ` Lars Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2022-03-05 11:32 UTC (permalink / raw)
To: Po Lu; +Cc: Lars Ingebrigtsen, 54245
>>>>> On Sat, 05 Mar 2022 08:45:03 +0800, Po Lu <luangruo@yahoo.com> said:
Po> That LGTM, but I only tested on GNUstep. The same code is also used on
Po> macOS, so there might be some side effects.
Iʼm on macOS
Po> Though the NS port is very old and I get the feeling that we keep
Po> bumping into relics from over two decades ago, and using `select' might
Po> very well be one of those.
Every platform has a replacement for `select', but theyʼre all
different. The only real issue I see with (p)select is that you canʼt
wait on more than FD_SETSIZE descriptors.
Robert
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#54245: 29.0.50; select usage in GNUstep
2022-03-05 11:32 ` Robert Pluim
@ 2022-03-05 19:00 ` Lars Ingebrigtsen
0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-05 19:00 UTC (permalink / raw)
To: Robert Pluim; +Cc: Po Lu, 54245
Robert Pluim <rpluim@gmail.com> writes:
> Po> That LGTM, but I only tested on GNUstep. The same code is also used on
> Po> macOS, so there might be some side effects.
>
> Iʼm on macOS
Thanks; I've pushed Robert's patch to Emacs 29 now, and I'm therefore
closing this bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-05 19:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 15:30 bug#54245: 29.0.50; select usage in GNUstep Lars Ingebrigtsen
2022-03-04 16:10 ` Lars Ingebrigtsen
2022-03-04 16:15 ` Robert Pluim
2022-03-05 0:45 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05 11:32 ` Robert Pluim
2022-03-05 19:00 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).