Skip to content

fix panic on single-character volumes#2355

Merged
silvin-lubecki merged 1 commit into
docker:masterfrom
thaJeztah:fix_bind_panic
Feb 21, 2020
Merged

fix panic on single-character volumes#2355
silvin-lubecki merged 1 commit into
docker:masterfrom
thaJeztah:fix_bind_panic

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Feb 21, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

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

@silvin-lubecki silvin-lubecki left a comment

Copy link
Copy Markdown
Contributor

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