On 5/12/25 8:04 PM, Adam Purkrt wrote:
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
OS: Gentoo Linux


Originally met this while the download of iso file in firefox was
nearing completion, and I was preparing myself to move the
downloaded foobar.iso file elsewhere. I opened terminal with bash,
typed "mv foobar." in the Downloads dir and pressed <tab>. Two options
appeared: foobar.iso and and foobar.[somecode].iso.part. I kept pressing
<tab>, but after the download finished, with repeated presses bash kept displaying "foobar.iso" as a single option of completion and did not
complete to the already singular name.

This is (but see below) standard readline behavior. If the key
sequence for `complete' is entered two or more times in succession,
without changes to the line buffer in the meantime, readline executes
the equivalent of the `possible-completions' command.


Expected behaviour:

Bash should complete to "foobar.a" as soon as it is an unique option,
i.e. as soon as foobar.b is removed after 10 seconds. Offering a
singular option for completion does not make sense anyway.

I have changed readline in the past (readline-8.1) to insert a single
completion if the number of possible completions changes from 0 to 1,
when the previous complete command failed to produce any matches.

I may change it in the future to insert a single completion if the
number of possible completions changes from > 1 to 1. That will not
happen before bash-5.3, though.


Also, when, in the erroneous situation after the 10 seconds elapsed, the
"." at the end of filename is deleted and written again (visually the same situation) and then <tab> is pressed, the completion succeeds.

Yes, you changed the line before attempting completion again.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to