Skip to content

_comp_command_offset: duplicate results with direxpand #1355

@dseomn

Description

@dseomn

Describe the bug

With the direxpand bash option on, sudo completion of commands gives duplicate results which prevents ever completing anything.

To reproduce

$ sudo ~/.local/^C  # from typing: sudo ~/.loc<Tab><Ctrl-C>
$ shopt -s direxpand
$ sudo ~/.loc  # then press tab twice
.local/ .local/ 
$ sudo ~/.loc

Also tested with exec and nohup instead of sudo.

Expected behavior

With direxpand on, I think sudo ~/.loc<Tab> should complete to either sudo ~/.local/ or sudo /home/dseomn/.local/ (for my $HOME at least).

Versions (please complete the following information)

  • Operating system name/distribution and version: Debian testing
  • bash version, echo "$BASH_VERSION": 5.2.37(1)-release
  • bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.16.0

Additional context

N/A

Debug trace

sudo-completion-bug.txt

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