From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4885 invoked from network); 8 Jun 2001 19:53:18 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Jun 2001 19:53:18 -0000 Received: (qmail 9332 invoked by alias); 8 Jun 2001 19:52:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14818 Received: (qmail 9321 invoked from network); 8 Jun 2001 19:52:56 -0000 Date: Fri, 8 Jun 2001 15:53:09 -0400 From: Clint Adams To: Bart Schaefer Cc: zsh-workers@sunsite.dk Subject: Re: PATCH: check deleted .zwc files Message-ID: <20010608155309.A6700@dman.com> References: <20010608141719.A4626@dman.com> <010608115028.ZM5876@candle.brasslantern.com> <20010608150445.A5394@dman.com> <010608124608.ZM5942@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <010608124608.ZM5942@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Fri, Jun 08, 2001 at 12:46:08PM -0700 > I have a .zwc file for several functions. I update one of those functions. > I then remove and rebuild the .zwc file. Now, stat() of the .zwc shows > that it is newer than the function file, but any running zsh still has a > mapped descriptor on the removed file. With this code: > > if (stat(filename, buf)) { [...] > zwcstat() will cause zsh to decide that it can keep using the mapped copy, > even though the function file is actually newer than the mapped copy. Maybe I'm confused. If you've generated a new .zwc file, that stat() will return 0, and the mapped copy won't even be considered. > The only safe thing to do is to try the fstat() first, then stat(). To be > really complete, if fstat() and stat() disagree zsh should throw out the > mapped file and reload it, but that could get pretty tricky. Too tricky for me.