Subject: Re: bug#17172: 24.3.50; Timeouts when pasting from mouse

From: Jan Djärv <[email-masked]>
Date: Tue, 15 Apr 2014 19:29:20 +0200

Hello.

15 apr 2014 kl. 18:01 skrev Paul Eggert <[email-masked]>:

> Jan D. wrote:
>> I don't think xgselect has anything to do with this.  Either a response
>> comes on the X connection, or it doesn't.  It can't come anywhere else.
> 
> Although there's every chance you are right, the existing code is definitely buggy: if one of glib's fds is greater than xgselect's initial fds_lim, xgselect can inspect garbage in its masks, which can't be good.  

That can't happen, all masks are initialized with FD_ZERO.
If we passed masks with garbage in them to pselect we would get EINVAL back.
And we don't.

> There are some other glitches there too, e.g., mask bits might not be properly cleared if pselect times out and returns zero.

In that case, process.c does not inspect the masks, so this change fixes nothing.

> 
> Since the patch fixes bugs (even if not *this* bug) I installed it as emacs-24 bzr 116966.

Well, it does not fix any user visible bug, not any theoretical bug.
If this was a general select emulation you could argue that it did not conform to the select specification, but it is not that.  It is something for Emacs to use, and in that context you did not fix any bugs.  Nor does these changes have anything to do with this bug, you just used it as a means to get untested code into the emacs-24 branch.

	Jan D.