# HG changeset patch # User Franz Glasner # Date 1726434597 -7200 # Node ID ac7ab3d98cd271a54928b940b8a31276be5aef7f # Parent 4fd6be157c7032ef55933f90d3bc2ac03e9f5cfb farray.sh: more thorough index checks where needed. Numeric evaluation is sometimes sloppy and seems to return 0 on errors in many cases. diff -r 4fd6be157c70 -r ac7ab3d98cd2 share/local-bsdtools/farray.sh --- a/share/local-bsdtools/farray.sh Sun Sep 15 22:35:37 2024 +0200 +++ b/share/local-bsdtools/farray.sh Sun Sep 15 23:09:57 2024 +0200 @@ -390,6 +390,7 @@ [ -z "${__farr_index}" ] && _farr_fatal "no valid index for set given" # make it to a number __farr_index=$((__farr_index + 0)) + [ ${__farr_index} -lt 1 ] && _farr_fatal "index must be >= 1" __farr_value="${3-}" # For proper quoting: see farray_append @@ -644,7 +645,9 @@ __farr_searched_value="$2" __farr_start=$((${4-1} + 0)) + [ ${__farr_start} -lt 1 ] && _farr_fatal "start index must be >= 1" __farr_end=$((${5-${__farr_len}} + 0)) + [ ${__farr_end} -lt 1 ] && _farr_fatal "end index must be >= 1" __farr_cur_idx=${__farr_start} while [ ${__farr_cur_idx} -le ${__farr_end} ]; do