From cb17a8bbf3989c0ebbebca0310dc7009f3442df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sat, 13 Sep 2025 16:32:32 +0200 Subject: [PATCH] Use linear arrays in ispell test to work with old bash * test/lisp/textmodes/ispell-resources/fake-aspell-new.bash: Avoid using associative arrays since they are not available in old bash versions that come with some systems (bug#79177). --- .../ispell-resources/fake-aspell-new.bash | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash b/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash index 1eb004f6ba6..dec4f2d1667 100755 --- a/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash +++ b/test/lisp/textmodes/ispell-resources/fake-aspell-new.bash @@ -22,10 +22,18 @@ show_vv() printf '%s\n' "@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.0)" } +in_dict() +{ + local x=$1 + for y in ${sessiondict[@]}; do + if [ $y = $x ]; then return 0; fi + done + return 1 +} + imitate_pipe() { local a - declare -A sessiondict show_vv while read a ; do #printf 'pipe="%s"\n' "$a" >> /tmp/lwf_mock-aspell.log @@ -34,13 +42,13 @@ imitate_pipe() elif [[ "$a" == '+' || "$a" == '~nroff' || "$a" == '~tex' || "$a" == '!' || "$a" == '-' || "$a" == '%' ]] ; then printf '' elif [[ "${a:0:1}" == '@' ]] ; then - sessiondict["${a:1}"]="true" + sessiondict+=("${a:1}") printf '' else for b in $a ; do if [[ "$b" == '^' ]] ; then printf '' - elif [[ ${sessiondict[$b]} == 'true' || ${sessiondict[${b#^}]} == 'true' ]] ; then + elif in_dict "$b" || in_dict "${b#^}" ; then printf '*\n' elif [[ "$b" == '^tarampampamtararam' || "$b" == 'tarampampamtararam' ]] ; then printf '# tarampampamtararam 0\n' # wrong word