RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1327529 - atomic top command doesn't work w/ the -o short option is separated by a space from the option argument
Summary: atomic top command doesn't work w/ the -o short option is separated by a spa...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: atomic
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Brent Baude
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-15 10:11 UTC by Alex Jia
Modified: 2016-11-04 09:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 09:05:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2628 0 normal SHIPPED_LIVE atomic bug fix and enhancement update 2016-11-03 18:17:14 UTC

Description Alex Jia 2016-04-15 10:11:18 UTC
Description of problem:
Very minor issue, as usual, a short option is separated by a space from the option argument, e.g. -n ARG or -nARG, but the atomic top -o {time,stime,ppid,uid,gid,user,group} <image> doesn't work.


Version-Release number of selected component (if applicable):

[cloud-user@plat-infra-4zpfp3 ~]$ sudo atomic host status
  TIMESTAMP (UTC)         VERSION     ID             OSNAME               REFSPEC                                                        
* 2016-04-12 14:20:45     7.2.3-1     644fcc6035     rhel-atomic-host     rhel-atomic-host-ostree:rhel-atomic-host/7/x86_64/standard

[cloud-user@plat-infra-4zpfp3 ~]$ rpm -q atomic docker
atomic-1.9-4.gitff44c6a.el7.x86_64
docker-1.9.1-25.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. docker run -d -it busybox /bin/sh
2. docker ps
3. atomic top -n 2 -o user <container_id>

Actual results:

[cloud-user@plat-infra-4zpfp3 ~]$ sudo docker ps
CONTAINER ID        IMAGE                                      COMMAND             CREATED             STATUS              PORTS               NAMES
194a92caef3f        busybox                                    "/bin/sh"           4 seconds ago       Up 3 seconds                            thirsty_brattain

[cloud-user@plat-infra-4zpfp3 ~]$ sudo atomic top -n 2 194a92caef3f|grep bin
194a92caef3f thirsty_brattain 15906      0.1    0.0    0      0      /bin/sh
194a92caef3f thirsty_brattain 15906      0.1    0.0    0      0      /bin/sh

[cloud-user@plat-infra-4zpfp3 ~]$ sudo atomic top -n 2 -ouser 194a92caef3f|grep -iA1 user
CONTA(I)NER* (N)AME           (P)ID      (C)PU  (M)EM  (U)ID  (G)ID  USER       CMD    
194a92caef3f thirsty_brattain 15906      0.0    0.0    0      0      root       /bin/sh
--
CONTA(I)NER* (N)AME           (P)ID      (C)PU  (M)EM  (U)ID  (G)ID  USER       CMD    
194a92caef3f thirsty_brattain 15906      0.0    0.0    0      0      root       /bin/sh

[cloud-user@plat-infra-4zpfp3 ~]$ sudo atomic top -n 2 -o=user 194a92caef3f|grep -iA1 user
CONTA(I)NER* (N)AME           (P)ID      (C)PU  (M)EM  (U)ID  (G)ID  USER       CMD    
194a92caef3f thirsty_brattain 15906      0.0    0.0    0      0      root       /bin/sh
--
CONTA(I)NER* (N)AME           (P)ID      (C)PU  (M)EM  (U)ID  (G)ID  USER       CMD    
194a92caef3f thirsty_brattain 15906      0.0    0.0    0      0      root       /bin/sh

[cloud-user@plat-infra-4zpfp3 ~]$ sudo atomic top -n 2 -o user 194a92caef3f|grep -iA1 user
/bin/atomic: argument -o/--optional: invalid choice: '194a92caef3f' (choose from 'time', 'stime', 'ppid', 'uid', 'gid', 'user', 'group')
Try 'atomic top --help' for more information.

NOTE: the short option should be separated by a space not '=' from the option argument


Expected results:

Additional info:

In addtion, it seems we have implemented many -o/--optional options[1], but it only supports {time,stime,ppid,uid,gid,user,group} options in -o/--optional now.

[1]
[root@dell-per630-02 atomic]# grep "'shortname':" Atomic/top.py
            {'shortname': '%CPU', 'column': '(C)PU', 'character': 'c', 'sort': True, 'index': 3,
            {'shortname': 'CID', 'column': 'CONTA(I)NER', 'character': 'i', 'sort': True, 'index': 0,
            {'shortname': 'NAME', 'column': '(N)AME', 'character': 'n', 'sort': True, 'index': 1,
            {'shortname': 'PID', 'column': '(P)ID', 'character': 'p', 'sort': True, 'index': 2,
            {'shortname': '%MEM', 'column': '(M)EM', 'character': 'm', 'sort': True, 'index': 4,
            {'shortname': 'CMD', 'column': 'CMD', 'character': None, 'sort': False, 'index': 99,
            {'shortname': 'TIME', 'column': '(T)IME', 'character': 't', 'sort': True, 'index': 6,
            {'shortname': 'STIME', 'column': '(S)TIME', 'character': 's', 'sort': True, 'index': 7,
            {'shortname': 'PPID', 'column': 'PPI(D)', 'character': 'd', 'sort': True, 'index': 8,
            {'shortname': 'UID', 'column': '(U)ID', 'character': 'u', 'sort': True, 'index': 9,
            {'shortname': 'GID', 'column': '(G)ID', 'character': 'g', 'sort': True, 'index': 10,
            {'shortname': 'USER', 'column': 'USER', 'character': None, 'sort': False, 'index': 11,
            {'shortname': 'GROUP', 'column': 'GROUP', 'character': None, 'sort': False, 'index': 12,


It's a trivial matter, so I think we may fix them in one patch.

Comment 2 Daniel Walsh 2016-08-26 19:00:06 UTC
Seems to work correctly in current release.

Fixed in atomic-1.10.

Comment 3 Alex Jia 2016-08-29 16:17:45 UTC
(In reply to Daniel Walsh from comment #2)
> Seems to work correctly in current release.
> 
> Fixed in atomic-1.10.

It still doesn't work for me.

[cloud-user@atomic-host-001 ~]$ rpm -q atomic
atomic-1.10.5-7.el7.x86_64

[cloud-user@atomic-host-001 ~]$ sudo atomic top -n 2 -o user 391f5e6bb67a
/usr/bin/atomic: argument -o/--optional: invalid choice: '391f5e6bb67a' (choose from 'time', 'stime', 'ppid', 'uid', 'gid', 'user', 'group')
Try 'atomic top --help' for more information.

Comment 4 Daniel Walsh 2016-08-29 16:32:21 UTC
Could you check atomic-1.11

Comment 5 Alex Jia 2016-08-29 16:40:12 UTC
(In reply to Daniel Walsh from comment #4)
> Could you check atomic-1.11

It also doesn't work on upstream atomic.

[root@dhcp-2-50 atomic]# git rev-parse HEAD
70c51001c07311aec1b72079e9c1917af80bcd3c

[root@dhcp-2-50 atomic]# ./atomic top -n 2 -o user a5ffa272e45a
atomic top: argument -o/--optional: invalid choice: 'a5ffa272e45a' (choose from 'time', 'stime', 'ppid', 'uid', 'gid', 'user', 'group')
Try 'atomic top --help' for more information.

Comment 6 Daniel Walsh 2016-08-29 17:17:38 UTC
Alex see if this fixes the issue for you

https://github.com/projectatomic/atomic/pull/569

Comment 7 Alex Jia 2016-08-30 00:51:37 UTC
(In reply to Daniel Walsh from comment #6)
> Alex see if this fixes the issue for you
> 
> https://github.com/projectatomic/atomic/pull/569

Daniel, it works well for me.

Comment 8 Daniel Walsh 2016-08-30 10:14:50 UTC
Fixed in atomic-1.12

Comment 10 Alex Jia 2016-09-18 02:59:52 UTC
This bug has been fixed in atomic-1.12.0-1.el7.x86_64, so moving to VERIFIED status.

Comment 12 errata-xmlrpc 2016-11-04 09:05:57 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.

https://rhn.redhat.com/errata/RHBA-2016-2628.html


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