Bug 1004385

Summary: rhsm-icon bash completions should not end with a comma
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Carter Kozak <ckozak>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5CC: bkearney, ckozak, fsharath, jesusr
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Consequence: tab completion displays comma (,) after option. Fix: Remove the comma Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 21:28:31 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:    
Bug Blocks: 862910    

Description John Sefler 2013-09-04 14:12:21 UTC
Description of problem:

[root@jsefler-6 ~]# rhsm-icon -<TAB><TAB>
-c,                   --check-period,       --debug,              -f,                   -h,                   --help-all,           -i,
--check-immediately,  -d,                   --display             --force-icon,         --help,               --help-gtk,       

With the exception of "--display", notice that all of the proposed tab completions above end with a comma.  This should not happen.  The tab completions should be valid options; "-c" is a valid option, "-c," is not a valid option.

Version-Release number of selected component (if applicable):
[root@jsefler-6 ~]# rpm -q subscription-manager bash-completion
subscription-manager-1.9.5-1.el6.x86_64
bash-completion-1.3-7.el6.noarch

Offending file:
/etc/bash_completion.d/rhsm-icon

Comment 1 Carter Kozak 2013-09-12 15:07:37 UTC
commit b93b4fecbff480a443f0611667e0b68ebabb15f3
Author: ckozak <ckozak>
Date:   Wed Sep 4 10:44:55 2013 -0400

    1004385: rhsm icon completion fix

Comment 3 John Sefler 2013-09-13 18:27:27 UTC
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager bash-completion
subscription-manager-1.9.6-1.el6.x86_64
bash-completion-1.3-7.el6.noarch

[root@jsefler-6 ~]# rhsm-icon -h 
Usage:
  rhsm-icon [OPTION...] 

Help Options:
  -h, --help                  Show help options
  --help-all                  Show all help options
  --help-gtk                  Show GTK+ Options

Application Options:
  -c, --check-period          how often to check for validity (in seconds)
  -d, --debug                 show debug messages
  -f, --force-icon=TYPE       force display of the icon (expired, partial or warning)
  -i, --check-immediately     run the first status check right away
  --display=DISPLAY           X display to use

[root@jsefler-6 ~]# rhsm-icon -<TAB><TAB>
-c                   --debug              -h                   -i
--check-immediately  --display            --help               
--check-period       -f                   --help-all           
-d                   --force-icon         --help-gtk       


VERIFIED: tab completion of rhsm-icon properly displays all thirteen options (without comma suffix)

Comment 4 John Sefler 2013-09-16 02:32:04 UTC
Reopening this bug because we should include TAB completion on the gtk options too.

[root@jsefler-6 ~]# rhsm-icon --help-all 
Usage:
  rhsm-icon [OPTION...] 

Help Options:
  -h, --help                  Show help options
  --help-all                  Show all help options
  --help-gtk                  Show GTK+ Options

GTK+ Options
  --class=CLASS               Program class as used by the window manager
  --name=NAME                 Program name as used by the window manager
  --screen=SCREEN             X screen to use
  --gdk-debug=FLAGS           Gdk debugging flags to set
  --gdk-no-debug=FLAGS        Gdk debugging flags to unset
  --sync                      Make X calls synchronous
  --gtk-module=MODULES        Load additional GTK+ modules
  --g-fatal-warnings          Make all warnings fatal
  --gtk-debug=FLAGS           GTK+ debugging flags to set
  --gtk-no-debug=FLAGS        GTK+ debugging flags to unset

Application Options:
  -c, --check-period          how often to check for validity (in seconds)
  -d, --debug                 show debug messages
  -f, --force-icon=TYPE       force display of the icon (expired, partial or warning)
  -i, --check-immediately     run the first status check right away
  --display=DISPLAY           X display to use


As demonstrated in comment 3, tab completion is working for most all of the command options except the gtk options.  Please tab complete these too.


Additional info:  The gtk options differ between RHEL 5 and RHEL 6.  The RHEL 6 gtk options are shown above.  The RHEL5 gtk options are as follows...

[root@jsefler-5 ~]# rhsm-icon --help-gtk
Usage:
  rhsm-icon [OPTION...] 

GTK+ Options
  --class=CLASS               Program class as used by the window manager
  --name=NAME                 Program name as used by the window manager
  --display=DISPLAY           X display to use
  --screen=SCREEN             X screen to use
  --sync                      Make X calls synchronous
  --gtk-module=MODULES        Load additional GTK+ modules
  --g-fatal-warnings          Make all warnings fatal

On RHEL5, options --gdk-debug --gdk-no-debug --gtk-debug --gtk-no-debug are excluded.

On RHEL7, the gtk options appear to be the same as on RHEL6.

Comment 5 Carter Kozak 2013-09-19 18:36:43 UTC
commit 630000bf6239874f7485008d95a1409fde338014
Author: ckozak <ckozak>
Date:   Mon Sep 16 09:52:49 2013 -0400

    1004385: Add missing rhsm-icon debug options

Comment 6 John Sefler 2013-09-24 22:27:14 UTC
(In reply to Carter Kozak from comment #5)
>     1004385: Add missing rhsm-icon debug options

Looks like you misread comment 4

The GTK options that need to be added to the tab completion logic for subscription-manager on RHEL6 and RHEL7 are:
  --class
  --name
  --screen
  --gdk-debug
  --gdk-no-debug
  --sync
  --gtk-module
  --g-fatal-warnings
  --gtk-debug=FLAGS
  --gtk-no-debug=FLAGS

You only added tab completion logic for --gdk-debug --gdk-no-debug --gtk-debug --gtk-no-debug
Comment 4 says that on RHEL5 (FIVE) that subscription-manager's tab completion logic should exclude these debug options.

Moving back to ASSIGNED.

Comment 7 Carter Kozak 2013-09-25 13:42:49 UTC
Removing gtk-debug and gdk-debug options from rhsm-icon.

We will support tab completion of options visible from "rhsm-icon --help" not options from rhsm-icon --help-gtk, however the --help-gtk option will be completed

Comment 8 Carter Kozak 2013-09-25 14:21:25 UTC
commit 1b7422ea192803b39771a7bf38c8c9047680f94d
Author: ckozak <ckozak>
Date:   Wed Sep 25 09:43:23 2013 -0400

    1004385: remove some gtk help options

Comment 9 Bryan Kearney 2013-09-26 18:05:19 UTC
fixed in subscription-manager-1.9.7-1

Comment 10 John Sefler 2013-09-27 16:41:16 UTC
(In reply to Bryan Kearney from comment #9)
> fixed in subscription-manager-1.9.7-1

Nope: comment 8 has not yet been cherry-picked to RHEL6.5 subscription-manager-1.9.7-1.el6

Comment 13 Sharath Dwaral 2013-10-07 23:51:33 UTC
Version:

Tested on stage

# subscription-manager version 
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription-manager: 1.9.9-1.el6
python-rhsm: 1.9.6-1.el6

As per Comment 7, rhsm-icon will tab complete without GTK options

# rhsm-icon -
-c                   --check-period       --debug              -f                   -h                   --help-all           -i                   
--check-immediately  -d                   --display            --force-icon         --help               --help-gtk

VERIFIED

Comment 14 errata-xmlrpc 2013-11-21 21:28:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1659.html