Graphdriver: fix "device" mode not being detected if "character-device" bit is set#38758
Conversation
|
@kolyshkin @tonistiigi @dmcgowan PTAL Also wondering if this should be changed to moby/pkg/term/term_linux_test.go Lines 23 to 26 in 8e610b2 |
|
also opened containerd/continuity#139 for continuity |
|
hm... thought I checked, but looks like this does not fix the issue on Go 1.12; |
|
@thaJeztah 69206016 is |
Codecov Report
@@ Coverage Diff @@
## master #38758 +/- ##
=========================================
Coverage ? 36.54%
=========================================
Files ? 610
Lines ? 45394
Branches ? 0
=========================================
Hits ? 16589
Misses ? 26511
Partials ? 2294 |
|
Thanks @tonistiigi - I started to suspect that after adding the |
4939a90 to
2b43380
Compare
2b43380 to
85469f1
Compare
|
@tonistiigi thanks! Updated the PR, and took a slightly different approach that (I think) is a bit more defensive; let me know if this looks good to you (otherwise, I'll happily change it back to the old version) |
…e" 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>
85469f1 to
c7a38c2
Compare
|
LGTM |
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 through golang/go@a2a3dd0, but as a result, graphdrivers would no longer recognize "device" files, causing pulling of images that have a file with this filemode to fail;
The current code checked for an exact match of Modes to be set. The
os.ModeCharDeviceandos.ModeDevicebits will always be set in tandem, however, because the code was only looking for an exact match, this detection broke now thatos.ModeCharDevicewas added.This patch changes the code to be more defensive, and instead check if the
os.ModeDevicebit is set (either with, or without theos.ModeCharDevicebit).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.