From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: oops? read/write vs type of length parameter Date: Wed, 13 Apr 2011 12:31:48 -0700 Organization: UCLA Computer Science Department Message-ID: <4DA5FA24.1060203@cs.ucla.edu> References: <87wrj1jhfc.fsf@rho.meyering.net> <87hba5yq0p.fsf@uwakimon.sk.tsukuba.ac.jp> <834o64sxd7.fsf@gnu.org> <4DA3A7F8.1020503@cs.ucla.edu> <83k4f0qijz.fsf@gnu.org> <4DA3DDCD.10700@cs.ucla.edu> <4DA40AFE.8050406@cs.ucla.edu> <4DA47581.9010509@cs.ucla.edu> <4DA53148.5000903@cs.ucla.edu> <4DA55B85.5090305@cs.ucla.edu> <4DA5C9F6.3070209@cs.ucla.edu> <83bp0aqd6k.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1302723121 14726 80.91.229.12 (13 Apr 2011 19:32:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Apr 2011 19:32:01 +0000 (UTC) Cc: jim@meyering.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 13 21:31:57 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QA5nA-0007CV-FH for ged-emacs-devel@m.gmane.org; Wed, 13 Apr 2011 21:31:56 +0200 Original-Received: from localhost ([::1]:43754 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA5n9-0002oH-Ud for ged-emacs-devel@m.gmane.org; Wed, 13 Apr 2011 15:31:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA5n7-0002o0-6w for emacs-devel@gnu.org; Wed, 13 Apr 2011 15:31:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QA5n5-00080P-V8 for emacs-devel@gnu.org; Wed, 13 Apr 2011 15:31:53 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:46720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QA5n4-000805-Cp; Wed, 13 Apr 2011 15:31:50 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E155939E80DB; Wed, 13 Apr 2011 12:31:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MJKqKQRKfKG0; Wed, 13 Apr 2011 12:31:48 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3F06739E8083; Wed, 13 Apr 2011 12:31:48 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 In-Reply-To: <83bp0aqd6k.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138463 Archived-At: On 04/13/2011 10:22 AM, Eli Zaretskii wrote: >> it'd be nice to remove that silly 512 MiB limit. >> Would you object to such a change? > > Of course not! Why should I object to a great feature like that? OK, thanks, I'll take a look at it. This won't happen instantly. > The original code continued looping and trying to write the rest of > the stuff if emacs_write returned a positive value that is smaller > than what is was asked to write. The new code bails out of the loop > in that case, assuming that it's due to an error. Ah, thanks, now I see what you mean. The old code ignores write error in some cases, whereas the new code carefully reports the first write error it sees. Yes, that is a separate issue; I think it's a better approach, but it should be analyzed separately as it might lead to incompatibilities. The following further patch removes that part of the change, so that the new code (like the old) ignores the first write error after a partial write. * process.c (send_process): Count partial writes as successes. See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00483.html === modified file 'src/process.c' --- src/process.c 2011-04-13 05:02:54 +0000 +++ src/process.c 2011-04-13 19:20:49 +0000 @@ -5396,7 +5396,7 @@ else #endif written = emacs_write (outfd, buf, this); - rv = (written == this ? 0 : -1); + rv = (written ? 0 : -1); #ifdef ADAPTIVE_READ_BUFFERING if (p->read_output_delay > 0 && p->adaptive_read_buffering == 1)