zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] is-at-least compares zsh's version if $2 is provided but empty
Date: Sun, 28 May 2023 17:51:49 +0200	[thread overview]
Message-ID: <CAHYJk3Q7ckoifHQXkAXbyAfuO3GDNsXOF=uVRD+gMjLS6jTTXg@mail.gmail.com> (raw)
In-Reply-To: <20230528113907.hvxjuu4wwmettr5p@chazelas.org>

On 5/28/23, Stephane Chazelas <stephane@chazelas.org> wrote:
> autoload is-at-least
> is-at-least 7.2 "$(gcc -dumpfullversion 2> /dev/null)" ||
>   die "need gcc 7.2 or newer"
>
> Will fail to detect gcc not being available or from a
> version that didn't support -dumpfullversion when zsh 7.2 is
> out, because when the second argument is empty, is-at-least
> falls back to comparing zsh's own version instead.
>
> IMO, it should check whether $2 is provided or not rather than
> non-empty or not.
>
> diff --git a/Functions/Misc/is-at-least b/Functions/Misc/is-at-least
> index d4ff3552a..9546cb2b7 100644
> --- a/Functions/Misc/is-at-least
> +++ b/Functions/Misc/is-at-least
> @@ -25,7 +25,7 @@ emulate -L zsh
>  local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version order
>
>  min_ver=(${=1})
> -version=(${=2:-$ZSH_VERSION} 0)
> +version=(${=2-$ZSH_VERSION} 0)
>
>  while (( $min_cnt <= ${#min_ver} )); do
>    while [[ "$part" != <-> ]]; do

This requires more changes to be useful:
% is-at-least 1.9 ''; echo $?
1
% is-at-least 0.9 ''; echo $?
0

-- 
Mikael Magnusson


  reply	other threads:[~2023-05-28 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28 11:39 Stephane Chazelas
2023-05-28 15:51 ` Mikael Magnusson [this message]
2023-06-01 18:23   ` [PATCHv2] " Stephane Chazelas

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='CAHYJk3Q7ckoifHQXkAXbyAfuO3GDNsXOF=uVRD+gMjLS6jTTXg@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /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).