Bug 1151231 - Broken bash completion (does not occur when dnf-plugins-core installed)
Broken bash completion (does not occur when dnf-plugins-core installed)
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
21
Unspecified Unspecified
medium Severity unspecified
: ---
: ---
Assigned To: Igor Gnatenko
Fedora Extras Quality Assurance
:
: 1154094 1160744 1160967 1167125 (view as bug list)
Depends On: 1165189
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-09 16:17 EDT by Volker Sobek
Modified: 2014-12-13 04:53 EST (History)
12 users (show)

See Also:
Fixed In Version: dnf-0.6.3-2.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-12-13 04:53:47 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Volker Sobek 2014-10-09 16:17:56 EDT
Description of problem:

'dnf install <TAB>' does not work, one gets:

# dnf install cut: you must specify a list of bytes, characters, or fields
Try 'cut --help' for more information.

Version-Release number of selected component (if applicable):
dnf-0.6.2-1.fc21.noarch

How reproducible:
Always

Steps to Reproduce:
1. $ dnf install
2. press TAB

Actual results:
See description


Expected results:
List of packages available for installation
Comment 1 Parag Nemade 2014-10-09 23:27:24 EDT
For me this is working fine on Fedora 21. I just did
"sudo dnf install <TAB><TAB>" 
and this gave me
Display all 36406 possibilities? (y or n)
Comment 2 Tim Lauridsen 2014-10-10 00:30:16 EDT
also work for me

sudo dnf install <TAB><TABZ
Display all 43380 possibilities? (y or n)

it just take some time because the large amount of available packages
Comment 3 Volker Sobek 2014-10-10 02:37:48 EDT
(In reply to Tim Lauridsen from comment #2)
> also work for me
> 
> sudo dnf install <TAB><TABZ
> Display all 43380 possibilities? (y or n)
> 
> it just take some time because the large amount of available packages

Are you both using the same dnf-0.6.2-1.fc21.noarch version? I think the issue is present only in this most recent version; did you reboot since then? Or try starting a new bash with 'bash' to reload the bash completion, and then dnf install <TAB><TAB> again.
Comment 4 Parag Nemade 2014-10-10 02:59:43 EDT
Yes. Before commenting here I already reboot and using 
$ rpm -qa dnf*
dnf-0.6.2-1.fc21.noarch
dnf-plugins-core-0.1.3-1.fc21.noarch

Also, now I tested bash completion with success in my fedora 21 alpha VM also.
Comment 5 Volker Sobek 2014-10-10 06:32:33 EDT
(In reply to Parag from comment #4)
> Yes. Before commenting here I already reboot and using 
> $ rpm -qa dnf*
> dnf-0.6.2-1.fc21.noarch
> dnf-plugins-core-0.1.3-1.fc21.noarch
> 
> Also, now I tested bash completion with success in my fedora 21 alpha VM
> also.

Do you have the file /var/cache/dnf/available.cache? I don't have it on my machine, and thus part of the command used for completion is

COMPREPLY=( $( compgen -W '$( dnf --cacheonly list $cur* 2>/dev/null | cut -d' ' -f1 )' -- "$cur" ) )

from the line https://github.com/rpm-software-management/dnf/blob/6eceb2b4b7d37df72367e37ca5b49c4cc8061e8a/etc/bash_completion.d/dnf-completion.bash#L77

I can't run this line in bash without error, apparently due to the use of ' quoting inside ' quotes.
Comment 6 Volker Sobek 2014-10-10 07:08:08 EDT
/var/cache/dnf/available.cache is generated by the generate_completion_cache plugin from dnf-plugins-core, so you don't get this error when you have dnf-plugins-core installed.
Comment 7 Honza Silhan 2014-10-10 07:30:14 EDT
Igor, can you take a look, please?
Comment 8 Parag Nemade 2014-10-10 10:50:08 EDT
Yes. Igor re-wrote the bash completion so he is the contact person to look into this issue.

I have not further tested but looks like as dnf-plugins-core package being avoided to be pulled by default or in other words dnf don't need dnf-plugins-core when installed, bash completion code need to consider this issue. But I am not sure if we can have dnf bash completion working without dnf-plugins-core package.
Comment 9 Parag Nemade 2014-10-10 10:53:51 EDT
just removed dnf-plugins-core and cache files and yes I can reproduce this successfully. This really need to be fixed.
Comment 10 Igor Gnatenko 2014-10-10 12:07:38 EDT
I will take a look at this weekend. Thanks for reporting
Comment 11 Igor Gnatenko 2014-10-10 17:45:45 EDT
https://github.com/rpm-software-management/dnf/pull/168

Fixed.
Comment 12 Parag Nemade 2014-10-17 09:54:24 EDT
*** Bug 1154094 has been marked as a duplicate of this bug. ***
Comment 13 Parag Nemade 2014-11-05 09:57:06 EST
*** Bug 1160744 has been marked as a duplicate of this bug. ***
Comment 14 Parag Nemade 2014-11-05 23:31:39 EST
*** Bug 1160967 has been marked as a duplicate of this bug. ***
Comment 15 Igor Gnatenko 2014-11-18 09:47:54 EST
Hi, I'm again have time.
Comment 16 Igor Gnatenko 2014-11-19 10:12:28 EST
https://github.com/rpm-software-management/dnf/pull/181

I've implemented more better caching and one of commits fixing completion without dnf-plugins-core. you can clone my sqlite branch, execute `source etc/bash_completion.d/dnf-completion.bash` and try dnf install <TAB><TAB>.

It works for me now.
Comment 17 Honza Silhan 2014-11-24 15:57:53 EST
*** Bug 1167125 has been marked as a duplicate of this bug. ***
Comment 18 Fedora Update System 2014-12-09 09:06:41 EST
dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21
Comment 19 Fedora Update System 2014-12-11 23:32:46 EST
Package dnf-0.6.3-2.fc21, hawkey-0.5.2-1.fc21, dnf-plugins-core-0.1.4-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.6.3-2.fc21 hawkey-0.5.2-1.fc21 dnf-plugins-core-0.1.4-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-16760/dnf-0.6.3-2.fc21,dnf-plugins-core-0.1.4-1.fc21,hawkey-0.5.2-1.fc21
then log in and leave karma (feedback).
Comment 20 Fedora Update System 2014-12-13 04:53:47 EST
dnf-0.6.3-2.fc21, hawkey-0.5.2-1.fc21, dnf-plugins-core-0.1.4-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.