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: Mon, 13 Nov 2017 18:10:42 +0200 Message-ID: <83tvxykvlp.fsf@gnu.org> References: <83lgjz8eiy.fsf@gnu.org> <831slp98ut.fsf@gnu.org> <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> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1510589506 1829 195.159.176.226 (13 Nov 2017 16:11:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2017 16:11:46 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Matthias Dahl Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 13 17:11:43 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 1eEHKl-000061-Ot for ged-emacs-devel@m.gmane.org; Mon, 13 Nov 2017 17:11:39 +0100 Original-Received: from localhost ([::1]:55161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEHKt-0002Mt-8K for ged-emacs-devel@m.gmane.org; Mon, 13 Nov 2017 11:11:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEHJq-00027X-5B for emacs-devel@gnu.org; Mon, 13 Nov 2017 11:10:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEHJk-0005L6-Gw for emacs-devel@gnu.org; Mon, 13 Nov 2017 11:10:42 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEHJk-0005Ky-Cv; Mon, 13 Nov 2017 11:10:36 -0500 Original-Received: from [176.228.60.248] (port=1701 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eEHJj-0006Xk-N4; Mon, 13 Nov 2017 11:10:36 -0500 In-reply-to: (message from Matthias Dahl on Mon, 13 Nov 2017 15:13:28 +0100) 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:220143 Archived-At: > Cc: emacs-devel@gnu.org > From: Matthias Dahl > Date: Mon, 13 Nov 2017 15:13:28 +0100 > > > This is overkill, as the total amount of bytes read by a call to > > read_process_output cannot exceed 4096, so all we need is an unsigned > > counter with more than 12 bits. How about making it 'unsigned int' > > instead? It could even be 'unsigned short', though that might be > > overkill. Whatever size is chosen, the comment should say that the value > > recorded is the true value modulo the word size. > > That would not be enough. The counter is for the entire process lifetime > and not just for a single read back or chain of recursive read backs. We could reset the value to zero once it's consumed, in which case a narrower type would be okay. The price is a slight complication of the logic. > Regarding the ISO/IEC commentary, I thought it was worth mentioning here > since it is an important point to make that not everybody might know. > > But if there is consensus, I will remove the commentary and update the > if-statement to your version. Eli, what are your thoughts? Maybe make the comment shorter by just saying that a wrap-around could happen there in case of overflow. Thanks.