From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23899 invoked by alias); 13 Jul 2011 19:00:23 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16131 Received: (qmail 15970 invoked from network); 13 Jul 2011 19:00:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.43 is neither permitted nor denied by SPF record at ntlworld.com) X-ProxyUser-IP: 81.107.42.213 Date: Wed, 13 Jul 2011 19:53:29 +0100 From: Peter Stephenson To: Subject: Re: locking failed for /home/whoever/.zhistory: no such file or directory Message-ID: <20110713195329.1fdc1b35@pws-pc.ntlworld.com> In-Reply-To: <110713075444.ZM13017@torch.brasslantern.com> References: <201107101653.p6AGrute004254@pws-pc.ntlworld.com> <20110713150103.2f5c6226@pwslap01u.europe.root.pri> <110713075444.ZM13017@torch.brasslantern.com> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 13 Jul 2011 07:54:44 -0700 Bart Schaefer wrote: > On Jul 13, 3:01pm, Peter Stephenson wrote: > } Subject: Re: locking failed for /home/whoever/.zhistory: no such file or d > } > } > But my .zhistory is always empty. > } > } Is there a good reason you need to have the .zhistory file even though > } it's empty? > > I think he means zsh is never writing anything to the file, not that it > is intentionally always empty. That's not related to the locking problem, though, is it? It's very easy to ignore empty files completely. We always stat anyway in the "fast" case, so this only adds the operation in the normal case, where an extra stat is lost in the noise. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.113 diff -p -u -r1.113 hist.c --- Src/hist.c 12 Jul 2011 08:37:11 -0000 1.113 +++ Src/hist.c 13 Jul 2011 18:50:15 -0000 @@ -2246,10 +2246,12 @@ readhistfile(char *fn, int err, int read if (!fn && !(fn = getsparam("HISTFILE"))) return; + if (stat(unmeta(fn), &sb) < 0 || + sb.st_size == 0) + return; if (readflags & HFILE_FAST) { - if (stat(unmeta(fn), &sb) < 0 - || (lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime) - || lockhistfile(fn, 0)) + if ((lasthist.fsiz == sb.st_size && lasthist.mtim == sb.st_mtime) + || lockhistfile(fn, 0)) return; lasthist.fsiz = sb.st_size; lasthist.mtim = sb.st_mtime; -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/