Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
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
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker
Version: 7.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Lokesh Mandvekar
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2016-08-04 18:57 UTC by Ed Santiago
Modified: 2019-03-06 01:05 UTC (History)
4 users (show)

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

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:0116 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:


...and some were not:

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

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

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 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 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
is in this build.
Move to verified

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

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.

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