zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] is-at-least compares zsh's version if $2 is provided but empty
@ 2023-05-28 11:39 Stephane Chazelas
  2023-05-28 15:51 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Chazelas @ 2023-05-28 11:39 UTC (permalink / raw)
  To: Zsh hackers list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-01 18:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-28 11:39 [PATCH] is-at-least compares zsh's version if $2 is provided but empty Stephane Chazelas
2023-05-28 15:51 ` Mikael Magnusson
2023-06-01 18:23   ` [PATCHv2] " Stephane Chazelas

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).