Skip to content

COMP_POINT: substring expression < 0 when completing A= ./do #1383

@kpyrkosz

Description

@kpyrkosz

Describe the bug

COMP_POINT: substring expression < 0 when hitting a tab.

To reproduce

  • Type A= ./do
  • Move the cursor one character back, to point between d and o
  • Hit TAB
  • COMP_POINT: substring expression < 0 error pops up

Expected behavior

Not an error

Versions (please complete the following information)

Tested on Debian Stable (2.11-6) and Sid (2.16.0-7).

  • Operating system name/distribution and version: Debian Stable

  • bash version 5.2.15(1)-release

  • bash-completion version 2.11

  • Operating system name/distribution and version: Debian Sid

  • bash version 5.2.37(1)-release

  • bash-completion version 2.16.0

Debug trace

$ A= ./d+ local words
+ unset -v words
+ local offset i
+ offset=1
+ (( i = 1 ))
+ (( i <= COMP_CWORD ))
+ _comp_command_offset 1
+ local REPLY
+ _comp__find_original_word 1
+ REPLY=1
+ [[ -v cword ]]
+ return 0
+ local word_offset=1
+ local COMP_LINE=./do COMP_POINT=3 COMP_CWORD=0
+ comp_words=('./do')
+ local -a comp_words
+ COMP_WORDS=('./do')
+ local -a COMP_WORDS
+ local i tail
+ (( i = 0 ))
+ (( i < word_offset ))
+ tail=
+ (( COMP_POINT -= 4 - 0 ))
+ COMP_LINE=
+ (( i++ ))
+ (( i < word_offset ))
+ COMP_WORDS=("${COMP_WORDS[@]:word_offset}")
+ (( COMP_CWORD -= word_offset ))
+ COMPREPLY=()
+ local cur
+ _comp_get_words cur
+ local exclude= flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur= vcword= vprev= vwords=
+ getopts c:i:n:p:w: flag cur
+ [[ 1 -ge 1 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ (( OPTIND += 1 ))
+ [[ 1 -ge 2 ]]
+ _comp__get_cword_at_cursor '' words cword cur
+ words=()
+ local cword words
+ _comp__reassemble_words '' words cword
+ local exclude= i j line ref
+ [[ -n '' ]]
+ printf -v cword %s -1
+ [[ -n '' ]]
bash: COMP_POINT: substring expression < 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions