Bug 1151231

Summary: Broken bash completion (does not occur when dnf-plugins-core installed)
Product: [Fedora] Fedora Reporter: Volker Sobek <reklov>
Component: dnfAssignee: Igor Gnatenko <ignatenko>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 21CC: akozumpl, czerny.jakub, ignatenko, jsilhan, jskarvad, mluscon, packaging-team-maint, peljasz, pnemade, rholy, tim.lauridsen, whearn
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 09:53:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1165189    
Bug Blocks:    

Description Volker Sobek 2014-10-09 20:17:56 UTC
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-10 03:27:24 UTC
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 04:30:16 UTC
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 06:37:48 UTC
(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 06:59:43 UTC
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 10:32:33 UTC
(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 11:08:08 UTC
/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 11:30:14 UTC
Igor, can you take a look, please?

Comment 8 Parag Nemade 2014-10-10 14:50:08 UTC
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 14:53:51 UTC
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 16:07:38 UTC
I will take a look at this weekend. Thanks for reporting

Comment 11 Igor Gnatenko 2014-10-10 21:45:45 UTC
https://github.com/rpm-software-management/dnf/pull/168

Fixed.

Comment 12 Parag Nemade 2014-10-17 13:54:24 UTC
*** Bug 1154094 has been marked as a duplicate of this bug. ***

Comment 13 Parag Nemade 2014-11-05 14:57:06 UTC
*** Bug 1160744 has been marked as a duplicate of this bug. ***

Comment 14 Parag Nemade 2014-11-06 04:31:39 UTC
*** Bug 1160967 has been marked as a duplicate of this bug. ***

Comment 15 Igor Gnatenko 2014-11-18 14:47:54 UTC
Hi, I'm again have time.

Comment 16 Igor Gnatenko 2014-11-19 15:12:28 UTC
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 20:57:53 UTC
*** Bug 1167125 has been marked as a duplicate of this bug. ***

Comment 18 Fedora Update System 2014-12-09 14:06:41 UTC
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-12 04:32:46 UTC
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 09:53:47 UTC
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.