zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: zrecompile
Date: Wed, 5 Apr 2000 11:08:20 +0200 (MET DST)	[thread overview]
Message-ID: <200004050908.LAA02509@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Tue, 4 Apr 2000 16:43:05 +0200 (MET DST)


I wrote:

> Bart Schaefer wrote:
> 
> > ...
> >
> > Having thought about it a bit longer now, I have a suggestion: Put *both*
> > a .zwc version number *and* $ZSH_VERSION into the header.  When the .zwc
> > version doesn't match, display the $ZSH_VERSION string in the error output.
> > That completely hides the .zwc version from anyone who would be confused
> > by it, while avoiding the need to recompile when the shell is upgraded.
> 
> Wouldn't that be rather confusing? I mean: for some reason we have to
> change the zwc-version, but the ZSH_VERSION is still the same. The shell
> can't load an old zwc file and says: `wrong version (...)' where `...'
> is the same as $ZSH_VERSION.
> 
> This would only affect people upgrading their shell between releases,
> though... hm.

Because of that last one I could convince myself to make this
change. So, zwc files now use their magic number as the
zwc-file-version to compare. The zsh version is used to report version 
mismatches.

Bye
 Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.3
diff -u -r1.3 parse.c
--- Src/parse.c	2000/04/04 14:08:56	1.3
+++ Src/parse.c	2000/04/05 09:05:03
@@ -2197,7 +2197,10 @@
  * the version string in a field of 40 characters and the descriptions
  * for the functions in the dump file.
  *
- * NOTE: this layout has to be kept; everything after it may be changed.
+ * NOTES:
+ *  - This layout has to be kept; everything after it may be changed.
+ *  - When incompatible changes are made, the FD_MAGIC and FD_OMAGIC
+ *    numbers have to be changed.
  *
  * Each description consists of a struct fdhead followed by the name,
  * aligned to sizeof(wordcode) (i.e. 4 bytes).
@@ -2358,11 +2361,17 @@
     }
     if (read(fd, buf, (FD_PRELEN + 1) * sizeof(wordcode)) !=
 	((FD_PRELEN + 1) * sizeof(wordcode)) ||
-	(fdmagic(buf) != FD_MAGIC && fdmagic(buf) != FD_OMAGIC) ||
-	(v = strcmp(ZSH_VERSION, fdversion(buf)))) {
-	if (err)
-	    zwarnnam(nam, (v ? "invalid zwc file, wrong version: %s" :
-			   "invalid zwc file: %s") , name, 0);
+	(v = (fdmagic(buf) != FD_MAGIC && fdmagic(buf) != FD_OMAGIC))) {
+	if (err) {
+	    if (v) {
+		char msg[80];
+
+		sprintf(msg, "zwc file has wrong version (zsh-%s): %%s",
+			fdversion(buf));
+		zwarnnam(nam, msg , name, 0);
+	    } else
+		zwarnnam(nam, "invalid zwc file: %s" , name, 0);
+	}
 	close(fd);
 	return NULL;
     } else {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-04-05  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-05  9:08 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-04-04 14:43 Sven Wischnowsky
2000-04-04 14:07 Sven Wischnowsky
2000-04-04 14:37 ` 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=200004050908.LAA02509@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).