From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2548 invoked from network); 21 Apr 2008 13:19:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Apr 2008 13:19:54 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 91554 invoked from network); 21 Apr 2008 13:19:49 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Apr 2008 13:19:49 -0000 Received: (qmail 25991 invoked by alias); 21 Apr 2008 13:19:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24857 Received: (qmail 25974 invoked from network); 21 Apr 2008 13:19:46 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 21 Apr 2008 13:19:46 -0000 Received: from prunille.vinc17.org (vinc17.pck.nerim.net [213.41.242.187]) by bifrost.dotsrc.org (Postfix) with ESMTP id DC1AC808A37A for ; Mon, 21 Apr 2008 15:19:38 +0200 (CEST) Received: by prunille.vinc17.org (Postfix, from userid 501) id D3F3921BD4BC; Mon, 21 Apr 2008 15:19:37 +0200 (CEST) Date: Mon, 21 Apr 2008 15:19:37 +0200 From: Vincent Lefevre To: zsh-workers@sunsite.dk Subject: Re: [PATCH] history locking with fcntl Message-ID: <20080421131937.GM4304@prunille.vinc17.org> Mail-Followup-To: zsh-workers@sunsite.dk References: <20080415153120.GE1223@prunille.vinc17.org> <20080417162307.GB22594@blorf.net> <20080418005959.GB1067@prunille.vinc17.org> <20080419023155.GB23964@blorf.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20080419023155.GB23964@blorf.net> X-Mailer-Info: http://www.vinc17.org/mutt/ User-Agent: Mutt/1.5.17-vl-r21552 (2008-04-09) X-Virus-Scanned: ClamAV 0.91.2/6862/Mon Apr 21 13:26:20 2008 on bifrost X-Virus-Status: Clean On 2008-04-18 19:31:55 -0700, Wayne Davison wrote: > > I'll try it. > > Much appreciated. I've done a few tests and don't get history corruption. But my patch avoided a possible problem in rename() when there is a tmpfile. With your patch, one still has: if (fclose(out) < 0 && ret >= 0) ret = -1; if (ret >= 0) { if (tmpfile) { if (rename(tmpfile, unmeta(fn)) < 0) zerr("can't rename %s.new to $HISTFILE", fn); free(tmpfile); tmpfile = NULL; } Note that since out has been closed, tmpfile is no longer locked. The target file isn't locked either. Now, I don't think that rename() can be cached. So, I'd say that there should be no problems under "normal" conditions. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)