Bug 382097

Summary: yast2 bash completion broken
Product: [openSUSE] openSUSE 11.0 Reporter: Robin Knapp <robin.knapp>
Component: YaST2Assignee: Jan Kupec <jkupec>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: suse-beta
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:31:45 UTC
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 Robin Knapp 2008-04-21 20:34:31 UTC
also filed Bug 382098 (for zypper)
Comment 2 Jiri Srain 2008-04-22 13:18:16 UTC
The lowlight of your solution which I see is that the MODLIST variables will be generated again and again, which takes some time.

I find better approach to rename one of them. Let's prefix the variables with YAST, resp. ZYPPER.

Done for YaST, Jano, please, do it for zypper.
Comment 3 Robin Knapp 2008-04-22 13:22:02 UTC
Yes, that sounds sensible to me.

Mine was just a quick-fix...
Comment 4 Jan Kupec 2008-04-22 18:32:50 UTC
*** Bug 382098 has been marked as a duplicate of this bug. ***
Comment 5 Jan Kupec 2008-04-22 18:34:42 UTC
fixed in zypper, too, thanx :O) to be in zypper 0.11.1
Comment 6 Ladislav Slezák 2008-04-23 11:24:49 UTC
the yast fix has been submitted in yast2-2.16.55
Comment 7 Christian Boltz 2008-04-24 20:24:14 UTC
It looks everything in this bug is fixed.
Is there any reason why this bug is still open? If not, please close it.
Comment 10 Jan Kupec 2008-04-25 00:01:24 UTC
Yes there is a reason: zypper package with the fix was not yet submitted for building. Comming soon.
Comment 11 Jan Kupec 2008-04-27 22:30:24 UTC
submitted