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 1364238 - docker-1.12 regression: inconsistent exit codes in command-line flag processing
Summary: docker-1.12 regression: inconsistent exit codes in command-line flag processing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Lokesh Mandvekar
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-04 18:57 UTC by Ed Santiago
Modified: 2020-03-11 15:11 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-17 20:43:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:0116 0 normal SHIPPED_LIVE Moderate: docker security, bug fix, and enhancement update 2017-01-18 01:39:43 UTC

Description Ed Santiago 2016-08-04 18:57:47 UTC
Under docker-1.10, flag.go exits 125 when a command-line flag is missing a required argument. With docker-1.12.0-6.el7.x86_64 *most* commands do so... except for a seemingly random few:

   # docker load --input;echo $?
   flag needs an argument: --input
   See 'docker load --help'.
   1    <-- 125 with docker-1.10

   # docker ps --filters;echo $?         <-- same with -n or --format
   unknown flag: --filters
   See 'docker ps --help'.
   1    <-- 125 with docker-1.10

(List is not meant to be exhaustive; there are more).

If my diagnosis is correct, root cause is that as part of the cobra migration in June some NewXxxCommand() functions were added with this line:

    cmd.SetFlagErrorFunc(flagErrorFunc)

...and some were not:

    $ grep -L lagErrorFunc api/client/{image,container}/* | wc -l
    23

If this analysis is correct, I hope there's a less duplicationy way to solve this than adding cmd.SetFlagErrorFunc() to each source file!

Comment 2 Antonio Murdaca 2016-08-30 16:51:15 UTC
Reported upstream https://github.com/docker/docker/issues/26152

Fix should be straightforward - either adding that to each file or find some common place, we'll see.

Comment 3 Antonio Murdaca 2016-08-31 10:32:33 UTC
Upstream patch https://github.com/docker/docker/pull/25354 cannot be backported - I tried it and only after the 7 commits in that PR there were another about 10 to be backported as well in order to have docker to fully use cobra.

I'll try to update the code to use SetFlagErrorFunc where it's needed and carry a FIX patch to fix this.

Comment 4 Antonio Murdaca 2016-10-18 18:30:20 UTC
need to backport https://github.com/docker/docker/pull/26777 in docker-1.12 branch of projectatomic/docker to have this fixed in rhel docker-1.12 (docker-latest I believe)

Comment 5 Antonio Murdaca 2016-10-19 11:17:53 UTC
Fixed in branch docker-1.12, assigning to Lokesh to rebuild for RHEL

Comment 7 Luwen Su 2016-11-10 09:43:41 UTC
The exit code is `125` in docker-1.12.3-4.el7.x86_64, and confirmed 
https://github.com/docker/docker/pull/26777
is in this build.
Move to verified

# docker load --input;echo $?
flag needs an argument: --input
See 'docker load --help'.
125

Comment 9 errata-xmlrpc 2017-01-17 20:43:23 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/RHSA-2017-0116.html


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