From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9436 invoked by alias); 20 Jun 2014 08:58:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 9229 invoked by uid 89); 20 Jun 2014 08:57:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pd0-f181.google.com Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 20 Jun 2014 08:57:58 +0000 Received: by mail-pd0-f181.google.com with SMTP id v10so2762617pde.12 for ; Fri, 20 Jun 2014 01:57:56 -0700 (PDT) X-Received: by 10.68.136.5 with SMTP id pw5mr1097471pbb.106.1403254676617; Fri, 20 Jun 2014 01:57:56 -0700 (PDT) Received: from [192.168.1.23] ([124.127.118.42]) by mx.google.com with ESMTPSA id wn7sm40211843pab.18.2014.06.20.01.57.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Jun 2014 01:57:56 -0700 (PDT) Message-ID: <53A3F78E.6020803@gmail.com> Date: Fri, 20 Jun 2014 08:58:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: chet.ramey@case.edu, Andreas Schwab CC: palves@redhat.com, gdb-patches@sourceware.org, binutils@sourceware.org, bug-readline@gnu.org, amodra@gmail.com Subject: Re: [Bug-readline] [PATCH] readline/histfile.c: Check and retry write() operation in history_truncate_file() References: <5397C077.1080702@gmail.com> <53A1F78A.8020508@case.edu> <53A23D77.1040905@gmail.com> In-Reply-To: <53A23D77.1040905@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00727.txt.bz2 On 06/19/2014 09:31 AM, Chen Gang wrote: > > > On 06/19/2014 04:33 AM, Chet Ramey wrote: >> On 6/10/14, 10:35 PM, Chen Gang wrote: >>> For regular file, write() operation may also fail, so check it too. If >>> write() return 0, can simply wait and try again, it should not suspend >>> infinitely if environments have no critical issues. >> >> Readline-6.3 checks the return value from write() and returns a non-zero >> value to the history_truncate_file caller. I really don't think that >> waiting forever if write continues to return 0 is a great idea; an error >> return is enough to let the caller deal with it. >> Oh, sorry, after think of again, for me, we have to waiting forever if write() continues to return 0. When this case happens, the file is already truncated, and the left data which is writing to file will be free after return from history_truncate_file(). If return an error code in this case, the caller can not deal with it -- the log data which should be remained, have been lost, can not get them back again. > > That sounds fine to me, and I will send patch v2 for it. And excuse me, > I have to do some other things today, so I shall try to send it within 2 > days (within 2014-06-21) -- if it is too late, please help send it. > Thanks. -- Chen Gang Open, share, and attitude like air, water, and life which God blessed