Unable to autocomplete commands when I use the sudo command
Describe the bug
Unable to autocomplete commands when I use the sudo command, such as
sudo tdnf ...
and so on. I can not find out the solutions.
Reproduction steps
1. add a new user.
2. add the new user to the sudo list.
3. switch to the new user's account.
4. can not use the bash_completion and the root account also can not use the sudo autocomplete.
Expected behavior
when I use the sudo command, I can use TAB to auto complete the command.
Additional context
OS version: PhotonOS 4.0 Rev2
/cc @oliverkurth
After logging into the regular user account, run the following command:
complete -F _root_command sudo
You can add this to your .bash_profile / .bashrc, and all bash completions work smoothly. I tested this on my Ph4 vm, working as expected.
Thanks, it works. Will this issue be fixed in the future?
I have made the necessary changes in our bash spec, fixed rpm will be released soon. Thanks.
Fixed in https://github.com/vmware/photon/commit/49769c1c48dcd947cb40711c6e7f7495c9d80092 Please close this bug.
Good day, where in the
After logging into the regular user account, run the following command:
complete -F _root_command sudoYou can add this to your .bash_profile / .bashrc, and all bash completions work smoothly. I tested this on my Ph4 vm, working as expected.
Good day, where in the .bashrc file to add that line? under which line or before which line ?
No need to do add it anywhere, it's fixed in upstream already.
If at all you want to add it yourself, you can add it anywhere in your bashrc
This issue still exists in PhotonOS 5.0. I hope it can be dealt with as soon as possible.
Thanks for reporting this issue. Changes made in https://github.com/vmware/photon/commit/49769c1c48dcd947cb40711c6e7f7495c9d80092 was undone by https://github.com/vmware/photon/commit/2386008a951b39340a2c3964b621798b3fa40a64, I'm addressing it.
If you need a quick solution, please modify the file/usr/share/bash-completion/bash_completion
Change
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
to
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really sudo
Thanks for reporting this issue. Changes made in 49769c1 was undone by 2386008, I'm addressing it.
If you need a quick solution, please modify the file
/usr/share/bash-completion/bash_completionChangecomplete -F _comp_root_command fakeroot gksu gksudo kdesudo reallyto
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really sudo
Thanks a lot, it works.
Fixed by: https://github.com/vmware/photon/commit/51d64cdd5a8d5bd27802c813e49a2c9041ee5820