From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.bugs Subject: bug#29170: Infinite loop noticed on Emacs in OpenBSD Date: Thu, 09 Nov 2017 16:06:22 +0100 Message-ID: <87fu9n7aq9.fsf@elite.giraud> References: <87fu9rwksm.fsf@omecha.info> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1510240042 26963 195.159.176.226 (9 Nov 2017 15:07:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Nov 2017 15:07:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (berkeley-unix) To: 29170@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 09 16:07:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCoQB-0006c7-3U for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Nov 2017 16:07:11 +0100 Original-Received: from localhost ([::1]:37393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCoQI-0004sO-B2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Nov 2017 10:07:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCoQA-0004r9-If for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 10:07:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCoQ2-00077h-8T for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 10:07:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51860) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eCoQ2-00077N-59 for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 10:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eCoQ1-0004fs-Uc for bug-gnu-emacs@gnu.org; Thu, 09 Nov 2017 10:07:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87fu9rwksm.fsf@omecha.info> Resent-From: Manuel Giraud Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Nov 2017 15:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29170 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29170-submit@debbugs.gnu.org id=B29170.151023998517922 (code B ref 29170); Thu, 09 Nov 2017 15:07:01 +0000 Original-Received: (at 29170) by debbugs.gnu.org; 9 Nov 2017 15:06:25 +0000 Original-Received: from localhost ([127.0.0.1]:60541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCoPR-0004ez-Ff for submit@debbugs.gnu.org; Thu, 09 Nov 2017 10:06:25 -0500 Original-Received: from ledu-giraud.fr ([195.154.162.172]:3692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCoPP-0004eq-KZ for 29170@debbugs.gnu.org; Thu, 09 Nov 2017 10:06:24 -0500 Original-Received: from elite.giraud (10.1.1.1 [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 2341183a (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <29170@debbugs.gnu.org>; Thu, 9 Nov 2017 16:06:22 +0100 (CET) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139665 Archived-At: Hi, Here is a patch against HEAD to avoid the hang in infinite loop. The 'x-selection-timeout' pause will still be there even with this patch. My understandings: On OpenBSD, most of the time, the function "xselect.c/x_get_foreign_selection" won't get a SelectNotify with (SECONDARY, TEXT) as arguments (that I did not understand and it might never happen on other oses). But then, while waiting at most 'x-selection-timeout' into "process.c/wait_reading_process_output" the 'now' variable won't have a chance of being invalidated or updated and that is what cause the infinite loop. Someone more knowledgeable of "process.c/wait_reading_process_output" might have a better solution to this problem. diff --git a/src/process.c b/src/process.c index fc46e74332..25bd28a82b 100644 --- a/src/process.c +++ b/src/process.c @@ -5115,8 +5115,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, /* Exit if already run out. */ if (wait == TIMEOUT) { - if (!timespec_valid_p (now)) - now = current_timespec (); + now = current_timespec (); if (timespec_cmp (end_time, now) <= 0) break; timeout = timespec_sub (end_time, now); -- Manuel Giraud