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

Re: [PATCH] Show patchlevel in version string



On 4/10/22 17:35, Daniel Shahaf wrote:

> Wesley Schwengle wrote on Fri, Sep 03, 2021 at 13:38:03 -0400:
>> After this patch is applied, you get to see the following version string
>> after you configured zsh with `--enable-custom-patchlevel=$(git describe)':
>>
>>    $ ./Src/zsh --version
>>    zsh 5.8.0.2-dev (x86_64-pc-linux-gnu/zsh-5.8-481-g64befeb4c)
>
> Adding the git revision there makes sense, I suppose, but why should
> this only be done when that configure option is used?  The git revision
> is added to ZSH_PATCHLEVEL (which is a shell variable, not an
> environment variable) by default, without needing any configure flags.
>
> Or another perspective: CUSTOM_PATCHLEVEL is used to cause
> $ZSH_PATCHLEVEL to be set to something other than its default.  So,
> why shouldn't the #else branch emit the default value of $ZSH_PATCHLEVEL?
>
> tl;dr: Why not include the (build's default) value of $ZSH_PATCHLEVEL in
> the output?

I want to back track a little from my original answer from last Friday.

How do we progress, this patch in itself could be merged I think without
having to have all kinds of other logic to always show it. I think this
is a nice first step. I'm willing to work on the other solution to
always include a patch level based on some other logic.

However I placed the patch level between the brackets because I wasn't
sure if/how we want to display the version. As stated in the commit body
of the patch:

> Because I'm not aware how downstream deals with a difference in version
> strings I've decided to add it to the vendor/os type bit. Debian for
> example uses `debian/5.8-6+b2' as a patch level. This would probably
> break scripts which expect `zsh x.y.z' if the patch level replaced the
> ZSH_VERSION string.

$ zsh --version
zsh 5.9 (x86_64-debian-linux-gnu)

I would expect (or assume) that Debian wants to keep showing the 5.9
version and not the debian/5.9-4+b4 bit. This would make parsing the ZSH
version tricky, eg, zsh --version | awk '{print $2}' suddenly gives a
different output than scripts would expect.

If you run zsh --version from a bash shell you get the version string,
you don't have access to the $ZSH_VERSION shell variable.

Now, if we use this ZSH_PATCHLEVEL in any build, what logic are we going
to apply?

* Do we remove the CUSTOM_PATCHLEVEL output from the --version call if
the CUSTOM_PATCHLEVEL equals the ZSH_VERSION string?

* Do we replace the ZSH_VERSION with the CUSTOM_PATCHLEVEL if the
ZSH_VERSION includes -dev, eg 5.9.0.1-dev becomes 5.9-240-g51ae2a5ff

To reiterate. I'm open to add improvements to always displaying the
patch level, but I would love to see this patch merged before we agree
on more things. I think adding it to the OS/Vendor bit has very little
impact on scripts but it aids us in seeing what is being used (for
example when build from source).

Cheers,
Wesley

--
Wesley Schwengle
E: wesley@xxxxxxxxx






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