If a completion function installs a new compspec and returns 124, and the new compspec is for something other than the exact name currently being completed (i.e. a new default compspec, or a compspec for the basename of a command being completed that includes a slash), the newly installed compspec is not used on this completion attempt:
$ complete -r $ default() { complete -W foo -- cmd; return 124; } $ complete -F default -D $ /tmp/cmd ^I The subsequent completion attempt works as expected, so this obviously quite minor, but the fix seems trivial as well. --- pcomplete.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcomplete.c b/pcomplete.c index aa6a0440..845151c5 100644 --- a/pcomplete.c +++ b/pcomplete.c @@ -1564,7 +1564,7 @@ programmable_completions (const char *cmd, const char *word, #endif lastcs = 0; - found = count = 0; + count = 0; pcomp_line = rl_line_buffer; pcomp_ind = rl_point; @@ -1574,7 +1574,7 @@ programmable_completions (const char *cmd, const char *word, do { - retry = 0; + found = retry = 0; /* We look at the basename of CMD if the full command does not have an associated COMPSPEC. */ -- 2.45.1