Files
docker-cli/components/engine/daemon/graphdriver
Sebastiaan van Stijn a345ccfd0e Graphdriver: fix "device" mode not being detected if "character-device" bit is set
Due to a bug in Golang (github.com/golang#27640), the "character device"
bit was omitted when checking file-modes with `os.ModeType`.

This bug was resolved in Go 1.12, but as a result, graphdrivers
would no longer recognize "device" files, causing pulling of
images that have a file with this filemode to fail;

    failed to register layer:
    unknown file type for /var/lib/docker/vfs/dir/.../dev/console

The current code checked for an exact match of Modes to be set. The
`os.ModeCharDevice` and `os.ModeDevice` bits will always be set in
tandem, however, because the code was only looking for an exact
match, this detection broke now that `os.ModeCharDevice` was added.

This patch changes the code to be more defensive, and instead
check if the `os.ModeDevice` bit is set (either with, or without
the `os.ModeCharDevice` bit).

In addition, some information was added to the error-message if
no type was matched, to assist debugging in case additional types
are added in future.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c7a38c2c06f7ab844a48c6c447942913131b83d6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 3744b45ba8ad93f1a21cbc80420856b04efc4593
Component: engine
2019-02-20 14:31:18 +01:00
..
2018-10-03 14:01:13 +02:00
2018-06-13 09:04:30 +02:00
2018-06-13 09:04:30 +02:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-06-13 09:04:30 +02:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00
2018-02-05 16:51:57 -05:00