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

fix panic on single-character volumes #2355

Merged
merged 1 commit into from
Feb 21, 2020

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Feb 21, 2020

fixes moby/moby#40550 single digit volume name leads to 'panic: runtime error: index out of range'

Before this change, this would cause a panic:

docker run -it --rm -v 1:/1 alpine
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/docker/cli/cli/compose/loader.isFilePath(0xc42027e058, 0x1, 0x557dcb978c20)
...

After this change, a correct error is returned:

docker run -it --rm -v 1:/1 alpine
docker: Error response from daemon: create 1: volume name is too short, names should be at least two alphanumeric characters.

- Description for the changelog

* Fix panic: runtime error: index out of range when trying to use a single-letter volume

- A picture of a cute animal (not mandatory but encouraged)

Before this change, this would cause a panic:

    docker run -it --rm -v 1:/1 alpine
    panic: runtime error: index out of range

    goroutine 1 [running]:
    github.com/docker/cli/cli/compose/loader.isFilePath(0xc42027e058, 0x1, 0x557dcb978c20)
    ...

After this change, a correct error is returned:

    docker run -it --rm -v 1:/1 alpine
    docker: Error response from daemon: create 1: volume name is too short, names should be at least two alphanumeric characters.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

ping @ndeloof - you probably want to cherry-pick this as well

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@silvin-lubecki silvin-lubecki merged commit 59eee68 into docker:master Feb 21, 2020
@thaJeztah thaJeztah deleted the fix_bind_panic branch February 21, 2020 13:48
@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

single digit volume name leads to 'panic: runtime error: index out of range'
3 participants