From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: wait_reading_process_ouput hangs in certain cases (w/ patches) Date: Sun, 19 Nov 2017 17:42:50 +0200 Message-ID: <831skuff5x.fsf@gnu.org> References: <83tvyj62qg.fsf@gnu.org> <83r2tetf90.fsf@gnu.org> <5150d198-8dd3-9cf4-5914-b7e945294452@binary-island.eu> <83tvy7s6wi.fsf@gnu.org> <83inemrqid.fsf@gnu.org> <398f8d17-b727-d5d6-4a31-772448c7ca0d@binary-island.eu> <56e722a6-95a4-0e42-185c-f26845d4f4bf@binary-island.eu> <21237e45-a353-92f9-01ec-7b51640d2031@cs.ucla.edu> <83vaickfu2.fsf@gnu.org> <83tvxwkexg.fsf@gnu.org> <03261534-6bf5-1a5d-915f-d3c55aaa35e9@binary-island.eu> <206ebefa-7583-f049-140c-c8fd041b0719@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511106230 8812 195.159.176.226 (19 Nov 2017 15:43:50 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Nov 2017 15:43:50 +0000 (UTC) Cc: ml_emacs-lists@binary-island.eu, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 19 16:43:45 2017 Return-path: Envelope-to: ged-emacs-devel@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 1eGRkv-0001bN-U6 for ged-emacs-devel@m.gmane.org; Sun, 19 Nov 2017 16:43:38 +0100 Original-Received: from localhost ([::1]:53437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGRl3-0007jg-AQ for ged-emacs-devel@m.gmane.org; Sun, 19 Nov 2017 10:43:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGRkO-0007im-VR for emacs-devel@gnu.org; Sun, 19 Nov 2017 10:43:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGRkM-0000Zu-Dv for emacs-devel@gnu.org; Sun, 19 Nov 2017 10:43:05 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGRkM-0000Zl-Ap; Sun, 19 Nov 2017 10:43:02 -0500 Original-Received: from [176.228.60.248] (port=1933 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eGRkL-0005a7-L4; Sun, 19 Nov 2017 10:43:02 -0500 In-reply-to: (message from Paul Eggert on Sat, 18 Nov 2017 23:07:37 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220277 Archived-At: > Cc: emacs-devel@gnu.org > From: Paul Eggert > Date: Sat, 18 Nov 2017 23:07:37 -0800 > > * Fix the bug with carryover that I mentioned in > . Not sure what bug is that, and how would you propose to fix it. > * Document in the Elisp manual that filters and timers are supposed to do > "proper management and synchronization", and be clear about how this constrains > filters and timers. (This is probably the hardest part of the fix....) I will handle this part. > * Change the type of infd_num_bytes_read from EMACS_UINT to uintmax_t. This will > provide an extra margin of safety on some platforms. infd_num_bytes_read has > nothing to do with Emacs integers, and wider counts are safer. > > * Document in its comment that infd_num_bytes_read is actually the count modulo > UINTMAX_MAX + 1. > > * When assigning to got_some_output, ceiling it at INT_MAX to avoid overflow > problems. Something like the following, say: > > got_some_output = min (INT_MAX, (wait_proc->infd_num_bytes_read > - initial_wait_proc_num_bytes_read)); If we are using uintmax_t, why limit this by INT_MAX? Overflow of unsigned values should never be a problem, AFAIK.