Bug 1121168

Summary: docker panic: runtime error: invalid memory address or nil pointer dereference
Product: Red Hat Enterprise Linux 7 Reporter: Chris Evich <cevich>
Component: dockerAssignee: John Keck <jkeck>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: bsarathy, dwalsh, lsu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-18 20:46:25 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: 1109938    

Description Chris Evich 2014-07-18 14:29:00 UTC
Description of problem:
Running docker CLI with any flag that does not exist causes a go panic.

Version-Release number of selected component (if applicable):
docker-1.0.0-10.el7.x86_64
Docker version 1.0.0, build 20fdb42/1.0.0

How reproducible:
Very

Steps to Reproduce:
1. docker -x
2. docker '- '

Actual results:
flag provided but not defined: -x
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x45f8da]

goroutine 1 [running]:
runtime.panic(0x92b600, 0x12c61c8)
	/usr/lib/golang/src/pkg/runtime/panic.c:266 +0xb6
fmt.Fprintf(0x0, 0x0, 0x9f3df0, 0xd, 0x7f863ce42608, ...)
	/usr/lib/golang/src/pkg/fmt/print.go:221 +0xaa
github.com/dotcloud/docker/pkg/mflag.funcĀ·001()
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/_build/src/github.com/dotcloud/docker/pkg/mflag/flag.go:481 +0xf5
github.com/dotcloud/docker/pkg/mflag.(*FlagSet).usage(0xc2100383c0)
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/_build/src/github.com/dotcloud/docker/pkg/mflag/flag.go:778 +0x38
github.com/dotcloud/docker/pkg/mflag.(*FlagSet).failf(0xc2100383c0, 0xa69c50, 0x22, 0x7f863ce42788, 0x1, ...)
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/_build/src/github.com/dotcloud/docker/pkg/mflag/flag.go:770 +0x172
github.com/dotcloud/docker/pkg/mflag.(*FlagSet).Parse(0xc2100383c0, 0xc21000a010, 0x1, 0x1, 0xc210082b80, ...)
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/_build/src/github.com/dotcloud/docker/pkg/mflag/flag.go:937 +0x648
github.com/dotcloud/docker/pkg/mflag.Parse()
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/_build/src/github.com/dotcloud/docker/pkg/mflag/flag.go:961 +0x71
main.main()
	/builddir/build/BUILD/docker-20fdb42c41441eada996c1c4d5a0051b08854b99/docker/docker.go:79 +0x1ae8

goroutine 3 [syscall]:
os/signal.loop()
	/usr/lib/golang/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.initĀ·1
	/usr/lib/golang/src/pkg/os/signal/signal_unix.go:27 +0x31

goroutine 4 [syscall]:
runtime.goexit()
	/usr/lib/golang/src/pkg/runtime/proc.c:1394

goroutine 6 [runnable]:
text/template/parse.lexText(0xc210059980, 0xaeeb98)
	/usr/lib/golang/src/pkg/text/template/parse/lex.go:228 +0x35e
text/template/parse.(*lexer).run(0xc210059980)
	/usr/lib/golang/src/pkg/text/template/parse/lex.go:198 +0x40
created by text/template/parse.lex
	/usr/lib/golang/src/pkg/text/template/parse/lex.go:191 +0x117


Expected results:
Error: flag provided but not defined: -x
Usage of docker:
  --api-enable-cors=false                Enable CORS headers in the remote API
  -b, --bridge=""                        Attach containers to a pre-existing 
...

Comment 2 Daniel Walsh 2014-07-22 17:34:51 UTC
Fixed in docker-1.1.1-1.el7

Comment 3 Luwen Su 2014-08-05 09:34:05 UTC
# rpm -q docker
docker-1.1.2-6.el7.x86_64

# docker -x
flag provided but not defined: -x

# docker -
Error: Command not found:%!(EXTRA string=-)Usage: docker [OPTIONS] COMMAND [arg...]
 -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use

So set Verified

Comment 4 errata-xmlrpc 2014-09-18 20:46:25 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-2014-1266.html