-
Notifications
You must be signed in to change notification settings - Fork 639
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 media type on unpacking layer #257
Conversation
would be great to have a test for this :( not sure how this got past CI or manual testing |
@runcom Having a test for this is great, I'll try |
@@ -89,7 +89,7 @@ func (m *manifest) validate(w walker) error { | |||
|
|||
func (m *manifest) unpack(w walker, dest string) error { | |||
for _, d := range m.Layers { | |||
if d.MediaType != string(schema.MediaTypeImageConfig) { | |||
if d.MediaType != string(schema.MediaTypeImageLayer) { | |||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an error, not a continue
. Changing this to an error fixes the “wrong media-type” issue discussed in #261 (but not currently fixed by that PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the spec does not currently say that layers MUST have a particular type, so this is currently an:
unimplemented: unpacking layer with media-type %q
I expect the spec should clarify if it places bounds (upper or lower) on manifest layer[] media types, and once that happens we can adjust this to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking if the layers MUST have a particular type is not said in the spec currently, I think we should make it clear in the spec first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Wed, Sep 07, 2016 at 04:58:52AM -0700, Lei Jitang wrote:
@@ -89,7 +89,7 @@ func (m *manifest) validate(w walker) error {
func (m *manifest) unpack(w walker, dest string) error {
for _, d := range m.Layers {
if d.MediaType != string(schema.MediaTypeImageConfig) {
if d.MediaType != string(schema.MediaTypeImageLayer) { continue
@wking if the layers MUST have a particular type is not said in the
spec currently, I think we should make it clear in the spec first.
If the layers MUST have a particular type, then you should error out
here with “your manifest is broken”. If the spec does not limit the
allowed types (like now), then you should error out here with
“unimplemented type”. In no case that I can see should we be silently
ignoring an unrecognized type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wking If the spec does not limit the allowed types, I don't think we should error out on unpacking, we should just
unpacking the allowed typed layers. But I think this is another issue we should discuss more not related to this pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Wed, Sep 07, 2016 at 08:46:36PM -0700, Lei Jitang wrote:
@@ -89,7 +89,7 @@ func (m *manifest) validate(w walker) error {
func (m *manifest) unpack(w walker, dest string) error {
for _, d := range m.Layers {
if d.MediaType != string(schema.MediaTypeImageConfig) {
if d.MediaType != string(schema.MediaTypeImageLayer) { continue
@wking If the spec does not limit the allowed types, I don't think
we should error out on unpacking, we should just unpacking the
allowed typed layers. But I think this is another issue we should
discuss more not related to this pr
If there's any confusion, I'm fine punting this to another PR. The
media type fix is critical and obviously right. The continue→error
fix only matters for oddball manifests, so it's much less important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although the spec does not currently say that layers MUST have a particular type, so this is currently an:
unimplemented: unpacking layer with media-type %q
I expect the spec should clarify if it places bounds (upper or lower) on manifest layer[] media types, and once that happens we can adjust this to match.
is there an issue to clarify this aspect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Fri, Sep 09, 2016 at 03:07:52AM -0700, Antonio Murdaca wrote:
@@ -89,7 +89,7 @@ func (m *manifest) validate(w walker) error {
func (m *manifest) unpack(w walker, dest string) error {
for _, d := range m.Layers {
if d.MediaType != string(schema.MediaTypeImageConfig) {
if d.MediaType != string(schema.MediaTypeImageLayer) { continue
Although the spec does not currently say that layers MUST have a
particular type, so this is currently an:unimplemented: unpacking layer with media-type %q
I expect the spec should clarify if it places bounds (upper or
lower) on manifest layer[] media types, and once that happens we
can adjust this to match.is there an issue for this?
There are ~50 million open validation issues at the moment, so I
haven't opened up one specifically for this ;). I try and bring it up
where it impacts an existing issue/PR. Most recently in #286.
I nominate this PR for inclusion in 0.5.0. We should avoid releasing
tooling when we know unpacking is completely broken ;).
|
2f78263
to
019c23f
Compare
test added |
@@ -48,3 +64,60 @@ func TestUnpackLayerDuplicateEntries(t *testing.T) { | |||
t.Fatalf("Expected to fail with duplicate entry, got %v", err) | |||
} | |||
} | |||
func TestUnpackLayerRemovePartialyUnpackedFile(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line before this function?
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Signed-off-by: Lei Jitang <leijitang@huawei.com>
019c23f
to
0a76d61
Compare
ping @philips @vbatts @stevvooe @s-urbaniak PTAL, we can't use unpack without this |
LGTM - received this very same bug report on IRC and was hoping for this to be merged soon(ish). We can address any outstanding issues around the test in a follow up I guess. |
Signed-off-by: Lei Jitang leijitang@huawei.com
The media type on unpacking layer should be
MediaTypeImageLayer