Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: check deleted .zwc files
- X-seq: zsh-workers 14817
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Clint Adams <clint@xxxxxxx>
- Subject: Re: PATCH: check deleted .zwc files
- Date: Fri, 8 Jun 2001 12:46:08 -0700
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <20010608150445.A5394@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20010608141719.A4626@xxxxxxxx> <010608115028.ZM5876@xxxxxxxxxxxxxxxxxxxxxxx> <20010608150445.A5394@xxxxxxxx>
On Jun 8, 3:04pm, Clint Adams wrote:
> Subject: Re: PATCH: check deleted .zwc files
>
> > What happens if the file has been deleted and re-created? zwcstat()
> > will return the stat info for the newly-created file, but what will
> > autoloading do with the now-obsolete (?) file handle?
>
> Oops. It will do nothing with it, just as it did nothing with it before.
Maybe this is a flaw in the whole .zwc loading scheme, then.
What I'm getting at is this scenario:
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)) {
> #ifdef HAVE_FSTAT
> for (f = dumps; f; f = f->next) {
> + if (!strncmp(filename, f->filename, strlen(f->filename)) &&
> + !fstat(f->fd, buf))
> + return 0;
> }
> #endif
> return 1;
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.
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author