Bug 382098

Summary: zypper bash completion broken
Product: [openSUSE] openSUSE 11.0 Reporter: Robin Knapp <robin.knapp>
Component: libzyppAssignee: Jan Kupec <jkupec>
Status: RESOLVED DUPLICATE QA Contact: Duncan Mac-Vicar <dmacvicar>
Severity: Normal    
Priority: P5 - None    
Version: Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Robin Knapp 2008-04-21 20:32:58 UTC
(text copied from Bug 382097)

I discovered some weird behaviour with bash completion:

Scenario 1:

- Start new bash
- type "yast <tab><tab>"
-> you will get a list of all yast modules
- type "zypper <tab>" 
-> you will get "zypper add-on"

huh?

Scenatio 2:

- Start new bash
- type "zypper <tab><tab>"
-> you will get a list of all zypper commands
- type "yast2 <tab><tab>"
-> you will still get a list of all zypper commands

huh²?


So I grepped around a bit in /etc/bash_completion.d and found out:

zypper.sh and yast2_completion.sh share a variable and do NOT declare it as local, the variable is "MODLIST"

Also, zypper.sh does initialize "MODLIST" as yast2-completion.sh does.

Fix:

1. yast2_completion.sh
- move "MODLIST=()" inside the function and declare as local

2. zypper.sh
- add "MODLIST=()" inside the function and declare as local

Both work fine with this fix, but I'm not 100% sure if that's the correct solution (not familiar with bash completion scripts)
Comment 1 Jan Kupec 2008-04-22 18:32:50 UTC

*** This bug has been marked as a duplicate of bug 382097 ***