From 60e9049deb0ad7dc41d592bf838c1fb649319db6 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Sun, 26 Feb 2023 16:44:17 +0900 Subject: [PATCH] fix(strace): fix the test for an associative array The original test seems to try to check whether the array `syscalls` is non-empty, but this does not work for associative arrays. The expansion ${array_name} references ${array_name[0]}, but ${array_name[0]} does not necessarily exist even when the array is non-empty when the array is an associative array or a sparse array. We can explicitly check the number of elements. --- completions/strace | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions/strace b/completions/strace index ded9e45a031..349f2416290 100644 --- a/completions/strace +++ b/completions/strace @@ -42,7 +42,7 @@ _strace() $syscall =~ ^__NR_(.+) ]] && syscalls[${BASH_REMATCH[1]}]=1 done 2>/dev/null