This repository has been archived by the owner on Oct 13, 2023. It is now read-only.
[18.09 backport] Graphdriver: fix "device" mode not being detected if "character-device" bit is set #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
backport of moby#38758 for 18.09. Cherry-pick was clean; no conflicts
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;
The current code checked for an exact match of Modes to be set. The
os.ModeCharDevice
andos.ModeDevice
bits will always be set intandem, 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 withoutthe
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 c7a38c2)
Signed-off-by: Sebastiaan van Stijn github@gone.nl
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)