GNU bug report logs - #54245
29.0.50; select usage in GNUstep

Previous Next

Package: emacs;

Reported by: Lars Ingebrigtsen <larsi <at> gnus.org>

Date: Fri, 4 Mar 2022 15:31:01 UTC

Severity: minor

Tags: moreinfo

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54245 in the body.
You can then email your comments to 54245 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Fri, 04 Mar 2022 15:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars Ingebrigtsen <larsi <at> gnus.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 04 Mar 2022 15:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; select usage in GNUstep
Date: Fri, 04 Mar 2022 16:30:38 +0100

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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Fri, 04 Mar 2022 16:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 54245 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 54245 <at> debbugs.gnu.org
Cc: Alan Third <alan <at> idiocy.org>
Subject: Re: bug#54245: 29.0.50; select usage in GNUstep
Date: Fri, 04 Mar 2022 17:10:00 +0100
Lars Ingebrigtsen <larsi <at> 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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Mar 2022 16:11:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Mar 2022 16:11:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Fri, 04 Mar 2022 16:16:02 GMT) Full text and rfc822 format available.

Message #15 received at 54245 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 54245 <at> debbugs.gnu.org
Subject: Re: bug#54245: 29.0.50; select usage in GNUstep
Date: Fri, 04 Mar 2022 17:15:27 +0100
>>>>> On Fri, 04 Mar 2022 16:30:38 +0100, Lars Ingebrigtsen <larsi <at> 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
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Sat, 05 Mar 2022 00:46:01 GMT) Full text and rfc822 format available.

Message #18 received at 54245 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 54245 <at> debbugs.gnu.org
Subject: Re: bug#54245: 29.0.50; select usage in GNUstep
Date: Sat, 05 Mar 2022 08:45:03 +0800
Robert Pluim <rpluim <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Sat, 05 Mar 2022 11:33:01 GMT) Full text and rfc822 format available.

Message #21 received at 54245 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Po Lu <luangruo <at> yahoo.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 54245 <at> debbugs.gnu.org
Subject: Re: bug#54245: 29.0.50; select usage in GNUstep
Date: Sat, 05 Mar 2022 12:32:18 +0100
>>>>> On Sat, 05 Mar 2022 08:45:03 +0800, Po Lu <luangruo <at> 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
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54245; Package emacs. (Sat, 05 Mar 2022 19:02:02 GMT) Full text and rfc822 format available.

Message #24 received at 54245 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Po Lu <luangruo <at> yahoo.com>, 54245 <at> debbugs.gnu.org
Subject: Re: bug#54245: 29.0.50; select usage in GNUstep
Date: Sat, 05 Mar 2022 20:00:50 +0100
Robert Pluim <rpluim <at> 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




bug marked as fixed in version 29.1, send any further explanations to 54245 <at> debbugs.gnu.org and Lars Ingebrigtsen <larsi <at> gnus.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 05 Mar 2022 19:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 03 Apr 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.