zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Clint Adams <clint@zsh.org>
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH: check deleted .zwc files
Date: Fri, 8 Jun 2001 12:46:08 -0700	[thread overview]
Message-ID: <010608124608.ZM5942@candle.brasslantern.com> (raw)
In-Reply-To: <20010608150445.A5394@dman.com>

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.


  reply	other threads:[~2001-06-08 19:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-08 18:17 Clint Adams
2001-06-08 18:50 ` Bart Schaefer
2001-06-08 19:04   ` Clint Adams
2001-06-08 19:46     ` Bart Schaefer [this message]
2001-06-08 19:53       ` Clint Adams
2001-06-09  5:37         ` Andrej Borsenkow
2001-06-10 11:11           ` Clint Adams
2001-06-09 20:58         ` Bart Schaefer
2001-06-10 11:34           ` Clint Adams
2001-06-13  5:03             ` Bart Schaefer
2001-06-13  8:59               ` Sven Wischnowsky
2001-06-13 10:22                 ` Bart Schaefer
2001-06-18  7:31                   ` Sven Wischnowsky
2001-06-09 10:05 ` Cygwin failure " Andrej Borsenkow
2001-06-09 17:42   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=010608124608.ZM5942@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=clint@zsh.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).