diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Functions/Misc/is-at-least | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index e89ffee1b..fc3818213 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023-06-22 Bart Schaefer <schaefer@zsh.org> + + * Stephane: 51813: Functions/Misc/is-at-least: differentiate empty + $2 from omitted $2 to avoid wrong comparisons against ZSH_VERSION. + 2023-06-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> * 51877: Src/Modules/pcre.mdd, configure.ac: do not build pcre @@ -17,7 +22,7 @@ 2023-06-06 Peter Stephenson <p.stephenson@samsung.com> - * Stephan: 51818: Protect another ':'. + * Stephane: 51818: Protect another ':'. * Stephane: 51817: Protect some use of ':' from history modifier interpreation. diff --git a/Functions/Misc/is-at-least b/Functions/Misc/is-at-least index d4ff3552a..5985684be 100644 --- a/Functions/Misc/is-at-least +++ b/Functions/Misc/is-at-least @@ -24,8 +24,14 @@ emulate -L zsh local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version order +: ${2=$ZSH_VERSION} + +# sort out the easy corner cases first +[[ $1 = $2 ]] && return 0 # same version +[[ -n $2 ]] || return 1 # no version + min_ver=(${=1}) -version=(${=2:-$ZSH_VERSION} 0) +version=(${=2} 0) while (( $min_cnt <= ${#min_ver} )); do while [[ "$part" != <-> ]]; do |