Bug 4937 - urpme tab completion fails: missing the bash_completion function, _rpm_installed_packages()
Summary: urpme tab completion fails: missing the bash_completion function, _rpm_instal...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Guillaume Rousse
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-14 01:19 CET by Richard Neill
Modified: 2012-03-27 19:49 CEST (History)
1 user (show)

See Also:
Source RPM: urpmi
CVE:
Status comment:


Attachments

Description Richard Neill 2012-03-14 01:19:34 CET
Description of problem:

urpme tab completion doesn't work. 


Steps to Reproduce:

1. Type (as root):   "urpme apac[TAB_KEY]"

2. Expect urpme to tab-complete on packages matching apache-*

3. Actually, I get:

  urpme apacbash: _rpm_installed_packages: command not found.


The function _rpm_installed_packages is called from the file /etc/bash_completion.d/urpmi. 




Aside: the rpmdevtools package contains the similarly named
 _rpmdev_installed_packages() in the file:
/etc/bash_completion.d/rpmdevtools.bash-completion
Manuel Hiebel 2012-03-14 01:28:47 CET

Assignee: bugsquad => guillomovitch
Source RPM: urpmi-6.46-1.mga2 => urpmi

Comment 1 Dave Hodgins 2012-03-14 18:43:27 CET
Try uninstalling packagekit-command-not-found

CC: (none) => davidwhodgins

Comment 2 Richard Neill 2012-03-14 18:56:48 CET
(In reply to comment #1)
> Try uninstalling packagekit-command-not-found


I didn't have that installed anyway. Installing it makes no difference.

The problem is that the function _rpm_installed_packages()  is never defined in /etc/bash_completion.d/*    This function is called in several places, but not defined.

It looks as though there should be a file:  /etc/bash_completion.d/rpm  but this does not exist, nor does urpmf locate one.
Comment 3 Guillaume Rousse 2012-03-14 19:47:26 CET
This function is defined in /usr/share/bash-completion/completions/rpm, which is dynamically loaded the first time rpm completion is attempted. Just try 'rpm -<TAB>', then 'urpme <TAB>'.

We need to force rpm completion loading from another completion here.

Status: NEW => ASSIGNED

Comment 4 Richard Neill 2012-03-14 20:45:21 CET
That's rather clever (and yes, it does work).

I'm curious: why are some completions in /usr/share/bash-completion/completions/
while others are in /etc/bash_completion.d .  This would probably suggest moving urpmi's completion function while we are at it.
Comment 5 Guillaume Rousse 2012-03-15 10:27:19 CET
upstream project bash-completion now install all its completion files under /usr/share, and ensure they are automatically loaded when needed. Individual projects still install under /etc/bash_completion.d, where they are automatically sourced each time a new shell is created.

I'm not sure just changing files location is enough, I think some adaptation is also needed.
Comment 6 Guillaume Rousse 2012-03-15 21:57:30 CET
I just commited a fix in svn, I'm waiting for urpmi maintainer input before issuing a new release.
Comment 7 Guillaume Rousse 2012-03-27 19:49:10 CEST
Fix released in urpmi 6.48.

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


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