Skip to content

Tab completing cd aliases broke in 2.12.0 (worked in 2.11) #1123

Closed
@ruohola

Description

@ruohola

Describe the bug

Autocompleting an cd'able alias (needs Bash option shopt -s cdable_vars to be set) does not work in version 2.12.0

To reproduce

With this .bashrc:

[ -f /opt/homebrew/bin/brew ] && eval "$(/opt/homebrew/bin/brew shellenv)"
[ -f /usr/local/bin/brew ] && eval "$(/usr/local/bin/brew shellenv)"

shopt -s cdable_vars

export bin="${HOME}/.local/bin"

[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ] && . "$(brew --prefix)/etc/profile.d/bash_completion.sh"

with bash-completion@2 2.11 one could type

$ cd b<TAB>

which would get autocompleted to

$ cd bin

but with bash-completion@2 2.12.0 doing the same does not autocomplete any aliases. Autocompletion for normal directories works still fine.

Expected behavior

Autocompleting cd'able aliases should work fine.

Versions (please complete the following information)

  • Operating system name/distribution and version: macOS 14.3.1
  • bash version, echo "$BASH_VERSION": 5.2.26(1)-release
  • bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.12.0 (worked on 2.11)

Additional context

I upgraded my brew packages one by one and can confirm that it worked right before upgrading bash-completion@2 and stopped right after that.

Debug trace

N/A

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