TAB completion with 'dnf' problem
TAB completion with 'dnf' problem
Is anyone else having a problem with TAB completion with 'dnf'? I've got the 'bash-completion' rpm installed. TAB completion works for commands like 'ls', 'cat', 'cp', but it doesn't work for 'dnf' - this is a little annoying when having to do a 'localinstall' option and the rpm file is 90 characters long. However, TAB completion DOES work if I use 'yum' instead. Is there some option that needs to be enabled in order for this to work for 'dnf'? Since 'dnf' is the new way of doing things, and since so many examples use it instead of 'yum', I'm trying to teach myself to use it instead. But not allowing tab completions makes that much more difficult, and has me falling back to utilizing the 'yum' command instead.
Re: TAB completion with 'dnf' problem
Since yum is a symlink to dnf-3, you should be quite safe to continue to use yum for now.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
-
- Posts: 2019
- Joined: 2015/02/17 15:14:33
- Location: Bulgaria
- Contact:
Re: TAB completion with 'dnf' problem
According to Red Hat, they do not expect anyone to switch from yum...
Re: TAB completion with 'dnf' problem
yum is the supported tool in RHEL.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: TAB completion with 'dnf' problem
Since yum's autocompletion doesn't support the new dnf features like modules or groups I wanted to try weather the dnf command's autocompletion does and ran into the same issue. After some investigaton I've managed to make dnf's bash completion work in CentOS 8.0 but unfortunately the features I wanted are not much better in dnf's completion either.
The issue lies in that the bash completion script in /usr/share/bash-completion/completions/dnf uses a python helper to do it's completion. Yum is not effected since it's completion file is separate and doesn't rely on this helper. There are multiple issues that prevent this from working. If you realy want to use dnf then here's how to fix them.
1. The bash completion script wants to use the python executable at /usr/libexec/system-python or /usr/bin/python3 none of which exist by default.
Fix: either install python3 to have the /usr/bin/python3 executable or create a symlink for system-python with
Alternatively you can edit the bash completion script to use /usr/libexec/platform-python instead
2. The pyhton helper it tries to use is missing from the dnf python module
Fix:
Copy the dnf/cli/completion_helper.py.in file from the official df github to the dnf module in python site-packages. Remove the .in extension and change the python executable at the beging of the file to the correct one.
Step by step:
Open the file with your favourite editor and replace the @PYTHON_EXECUTABLE@ with /usr/libexec/platform-python or just use sed
Last you just renam the file
With both these issues fixed dnf bash completion should work
The issue lies in that the bash completion script in /usr/share/bash-completion/completions/dnf uses a python helper to do it's completion. Yum is not effected since it's completion file is separate and doesn't rely on this helper. There are multiple issues that prevent this from working. If you realy want to use dnf then here's how to fix them.
1. The bash completion script wants to use the python executable at /usr/libexec/system-python or /usr/bin/python3 none of which exist by default.
Fix: either install python3 to have the /usr/bin/python3 executable or create a symlink for system-python with
Code: Select all
ln -s /usr/bin/platform-python /usr/bin/system-python
2. The pyhton helper it tries to use is missing from the dnf python module
Fix:
Copy the dnf/cli/completion_helper.py.in file from the official df github to the dnf module in python site-packages. Remove the .in extension and change the python executable at the beging of the file to the correct one.
Step by step:
Code: Select all
cd /usr/lib/python3.6/site-packages/dnf/cli
wget https://raw.githubusercontent.com/rpm-software-management/dnf/master/dnf/cli/completion_helper.py.in
Code: Select all
sed -i -e 's/@PYTHON_EXECUTABLE@/\/usr\/libexec\/platform-python/g'
Code: Select all
mv completion_helper.py.in completion_helper.py
Re: TAB completion with 'dnf' problem
I would suggest that you open a bug against it on bugzilla.redhat.com to report this and the fixes you've made. CentOS only repackages what is released for RHEL so to get things fixed you need to get them fixed in RHEL.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
- carlwgeorge
- Posts: 3
- Joined: 2016/02/26 14:32:59
Re: TAB completion with 'dnf' problem
This has been fixed upstream. That pull request references a closed bugzilla for a related issue, but the actual RHEL 8 bugzilla for this is here.