bash-completion icon indicating copy to clipboard operation
bash-completion copied to clipboard

ADB completion fails to discover some commands with ADB help output

Open andrey-blak opened this issue 3 weeks ago • 2 comments

Describe the bug

ADB Bash completion does not suggest the install command when pressing Tab after adb.

To reproduce

  1. Install bash-completion 2.16.0.
  2. Install Android SDK Platform Tools 37.0.1.
  3. Type adb and press Tab.
  4. Type adb ins and press Tab.
  5. Notice that install is missing in the completion suggestions.

Expected behavior

adb install and other available ADB commands should appear in Bash completion suggestions.

Versions (please complete the following information)

  • [ ] Operating system name/distribution and version: Ubuntu 26.04.1 LTS
  • [ ] bash version, echo "$BASH_VERSION": 5.3.9(1)-release
  • [ ] bash-completion version, (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): 2.16.0
  • [ ] ADB version: Android Debug Bridge version 1.0.41; Version 37.0.1-15733141

Additional context

The same issue affects other commands, including install-multiple, install-multi-package, pull, push, reboot, and shell.

The completion script attempts to extract commands from adb help using the assumption that command names are prefixed with adb:

_comp_split -a tmp "$("$1" help 2>&1 | _comp_awk '$1 == "adb" { print $2 }')"

Modern ADB versions output command names without the adb prefix, so these commands are not discovered.

Debug trace

adb-complet-debug.txt

andrey-blak avatar Nov 10 '26 07:11 andrey-blak

Install Android SDK Platform Tools 37.0.1.

How did you install it? The adb completions provided here are only used as a fallback, since google ships its own completion and we prefer the upstream one. See 479cc270c594c3c1655519eba8745933b50d120c For example on fedora installing android-tools automatically installs the upstream completion, so install is completed for me out of the box.

yedayak avatar Nov 12 '26 20:11 yedayak

I've actually downloaded android SDK from Android Developers. It comes without adb completion. As this is only a fallback, I guess the issue could be closed.

andrey-blak avatar Nov 13 '26 09:11 andrey-blak