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

Re: [PATCH] add patchlevel to --version output




Hello all,

First of all, thanks dana! I appreciate getting this patch rolling again.

On 5/30/26 20:56, dana wrote:
wesley brought w/49374 (and w/52045 etc -- for some reason the mla
doesn't thread any of the replies) to our attention on irc today. i
think it's a good idea, but we talked about it more and revised
with this patch, the patchlevel (custom or not) is displayed in the
--version output whenever it doesn't look like the default patchlevel
for a tagged release

The reason for bringing this up was because I noticed make suddenly showed version 5.9.999.3-test and I saw that we also had 5.9.0.4-test. So it didn't make sense. I noticed it was related to commit 115517ffcc9d2ba6aeada9656b7c1c8432cf3970 and Dana mentioned w/54608.

That kind of brings me to the crux of how to show versions of zsh, both for development (and people like me) who run zsh from source.

If the patch of Dana and me gets accepted we can focus probably on looking at what can be improved. My proposal is something similar to what git has, and in some terms, what zsh already has.

If you look closely at git, you'll see they look for a version file, which is shipped in the tarball, and use that to grab the version. Their versioning script also includes a version, similar to zsh's Config/version.mk. Their scripts generate, similar to zsh, a version.h file, where they include the version/revision and the biggest difference with zsh they also include the commit sha, which can be extracted from git with `git version --build-options`.

I'm thinking zsh could adopt a similar thing, but instead of using Config/version.mk, use a more dynamic approach.

On make, generate a version.h with the ZSH version which is taken from

git describe --dirty --match zsh-[0-9]*

A ZSH_VERSION_DATE, if the ZSH_VERSION matches a tag, get the tag date in UTC, otherwise take the current date of the build system. This is mostly needed for Doc/Makefile.in.

The script that generates this version.h will include a version number, eg, the version from the latest tag: 5.9.0. This is also the fallback when someone build zsh from source without using a tarball or a git-repo.

It would look something like this:

1. ZSH_PATCHLEVEL isn't needed anymore. zsh --version, build from source, will output:

  zsh 5.9.0.3-test-279-g8714db6 (arm-apple-darwin24.6.0)

2. If --dirty is used and someone builds with a dirty tree:

  zsh 5.9.0.3-test-279-g8714db6-dirty (arm-apple-darwin24.6.0)

3. Custom patch levels, such as Debian:

  zsh 5.9 [debian/5.9-8+b40] (arm-apple-darwin24.6.0)

4. If Debian builds from unrelease versions:

  zsh 5.9.0.3-test-279-g8714db6 [debian/5.9-9+b42] (arm-apple-
  darwin24.6.0)

There is one thing I think we shouldn't do, and that is using .999 in test releases, perhaps a better way is using ~, like Debian to indicate release candidates, eg 5.9.0~rc4 or 5.9.0~test1. is-at-least may need some additional logic to deal with this, but I think it is cleaner that 5.9.999.3-test. I see Fedora uses the tilde notation as well, so I think, that might be a better option.

I hope this makes sense.

Cheers,
Wesley

--
Wesley Schwengle




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