Skip to content
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 invalid argument error on push #9482

Merged
merged 1 commit into from Dec 3, 2014
Merged

Conversation

ncdc
Copy link
Contributor

@ncdc ncdc commented Dec 3, 2014

With 32ba6ab from #9261, TempArchive now closes the underlying file and
cleans it up as soon as the file's contents have been read. When pushing
an image, PushImageLayerRegistry attempts to call Close() on the layer,
which is a TempArchive that has already been closed. In this situation,
Close() returns an "invalid argument" error.

Add a Close method to TempArchive that does a no-op if the underlying
file has already been closed.

Signed-off-by: Andy Goldstein agoldste@redhat.com

@ncdc
Copy link
Contributor Author

ncdc commented Dec 3, 2014

@LK4D4 @jfrazelle @unclejack PTAL

@@ -607,3 +608,26 @@ func TestUntarInvalidSymlink(t *testing.T) {
}
}
}

type stringReadCloser struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is ioutil.NopCloser exactly for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured there was something...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use ioutil.NopCloser

With 32ba6ab from moby#9261, TempArchive now closes the underlying file and
cleans it up as soon as the file's contents have been read. When pushing
an image, PushImageLayerRegistry attempts to call Close() on the layer,
which is a TempArchive that has already been closed. In this situation,
Close() returns an "invalid argument" error.

Add a Close method to TempArchive that does a no-op if the underlying
file has already been closed.

Signed-off-by: Andy Goldstein <agoldste@redhat.com>
@jessfraz
Copy link
Contributor

jessfraz commented Dec 3, 2014

LGTM

@jessfraz jessfraz added this to the 1.4 milestone Dec 3, 2014
@jessfraz
Copy link
Contributor

jessfraz commented Dec 3, 2014

added to the 1.4 milestone, thanks for the fix :)

@LK4D4
Copy link
Contributor

LK4D4 commented Dec 3, 2014

LGTM

LK4D4 added a commit that referenced this pull request Dec 3, 2014
Fix invalid argument error on push
@LK4D4 LK4D4 merged commit c8ccfcb into moby:master Dec 3, 2014
@tiborvass
Copy link
Contributor

LGTM

@jessfraz
Copy link
Contributor

jessfraz commented Dec 3, 2014

cherry-picked for 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants