Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on empty project-directory #35

Closed
grishy opened this issue Jun 23, 2022 · 2 comments · Fixed by #36
Closed

Panic on empty project-directory #35

grishy opened this issue Jun 23, 2022 · 2 comments · Fixed by #36
Assignees

Comments

@grishy
Copy link

grishy commented Jun 23, 2022

Description
Panic in cobra

Steps to reproduce the issue:

  1. docker-compose --project-directory "" ps

Describe the results you received:

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/docker/compose-switch/redirect.Convert(0xc0000b8010, 0x4, 0x4, 0x9, 0xc0000c2628, 0x1)
        /home/runner/go/pkg/mod/github.com/docker/[email protected]/redirect/convert.go:32 +0x8ba
main.main.func1(0xc0000bc780, 0xc0000b8010, 0x4, 0x4, 0x0, 0x0)
        /home/runner/work/compose-v1v2-switch/compose-v1v2-switch/main.go:59 +0x14d
github.com/spf13/cobra.(*Command).execute(0xc0000bc780, 0xc0000b8010, 0x4, 0x4, 0xc0000bc780, 0xc0000b8010)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000bc780, 0xc000096df0, 0x0, 0x160d660)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
main.main()
        /home/runner/work/compose-v1v2-switch/compose-v1v2-switch/main.go:68 +0x185

Describe the results you expected:
Hmm, error or something like that

Output of docker compose version:

Docker Compose version v2.5.1

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.5.1)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 20
 Server Version: 20.10.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.104-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 9.73GiB
 Name: docker-desktop
 ID: UYE6:X3OH:4K6T:V3ZQ:EST7:QJ4X:2JR6:B6SP:ER4V:PI55:QW23:2KLX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false
@nicksieger nicksieger self-assigned this Jun 24, 2022
@nicksieger
Copy link
Member

Thanks for reporting. I have a unit test confirming this is an issue in compose-switch, so I'm going to move this there.

@nicksieger nicksieger transferred this issue from docker/compose Jun 24, 2022
@nicksieger
Copy link
Member

Turns out the bug exists both here and in compose itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants