Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Portability of zwc files between zsh versions



Hi,

If I use zcompile to create a digest with zsh 5.5, I find I cannot load
the resulting file with zsh 5.8 (or vice versa).

'zcompile -t' prints: "zcompile: zwc file has wrong version"

It seems from the source:
https://github.com/zsh-users/zsh/blob/master/Src/parse.c#L3250
that in order to use a zwc file, the version of zsh it was created with
must match exactly the version of zsh trying to load it?

I was expecting zwc files to be more portable than this, given the
comments in the manual:

     The created file always contains two versions of the compiled
     format, one for big-endian machines and one for small-endian
     machines. The upshot of this is that the compiled file is machine
     independent [...]

The comments in Src/parse.c make me think that the intent was that zwc
files should be loadable so long as FD_MAGIC|FD_OMAGIC haven't changed -
they last changed in 52b830353 (2001).
Ref also https://www.zsh.org/mla/workers/2000/msg01327.html

It seems that the ZSH_VERSION check was added back in d296535d3 (2007),
"23313: fix test for incorrect version in ZWC file".

I noticed this issue after zcompiling on a RHEL9 system (zsh 5.8) where
HOME is also accessible to RHEL8 (zsh 5.5) hosts. It's a bit of a
nuisance to have to maintain a separate zwc file for each zsh version.

Is it intentional that zwc files aren't portable between zsh versions?
If so, it would seem like the endian duplication wouldn't be that useful
in practice?

Thanks.




Messages sorted by: Reverse Date, Date, Thread, Author