Skip to content

Fix tar prefix header#34106

Merged
vdemeester merged 2 commits intomoby:masterfrom
tonistiigi:fix-tar-prefix-header
Jul 17, 2017
Merged

Fix tar prefix header#34106
vdemeester merged 2 commits intomoby:masterfrom
tonistiigi:fix-tar-prefix-header

Conversation

@tonistiigi
Copy link
Copy Markdown
Member

@tonistiigi tonistiigi commented Jul 14, 2017

fixes #33958
fixes #34092

One possible fix for #34092 , especially for the releases that can't wait for golang update.

golang/go@release-branch.go1.8...tonistiigi:revert-prefix-ignore

@dmcgowan @stevvooe @thaJeztah @tiborvass @andrewhsu

Signed-off-by: Tonis Tiigi <[email protected]>
@tonistiigi
Copy link
Copy Markdown
Member Author

We can also discuss better fixes than reverting but these should probably happen in upstream first.

@thaJeztah
Copy link
Copy Markdown
Member

@tonistiigi could you add your description in #34092 (comment) as commit message? (probably to the "test" commit, but could be both)

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

Fix and code itself LGTM, but left some comments

Comment thread pkg/archive/archive_test.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a short description of what we're testing for here?

Comment thread Dockerfile Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This Note should be added to all the Dockerfiles

@thaJeztah
Copy link
Copy Markdown
Member

@tonistiigi guess this one also fixes #33958 ?

@tonistiigi
Copy link
Copy Markdown
Member Author

guess this one also fixes #33958 ?

@thaJeztah yes

With docker-17.06.0 some images pulled do not extract properly. Some files don't appear in correct directories. This may or may not cause the pull to fail. These images can't be pushed or saved. 17.06 is the first version of Docker built with go1.8.

Cause

There are multiple updates to the tar package in go1.8.

https://go-review.googlesource.com/c/32234/ disables using "prefix" field when new tar archives are being written. Prefix field was previously set when a record in the archive used a path longer than 100 bytes.

Another change https://go-review.googlesource.com/c/31444/ makes the reader ignore the "prefix" field value if the record is in GNU format. GNU format defines that same area should be used for access and modified times. If the "prefix" field is not read, a file will only be extracted by the basename.

The problem is that with a previous version of the golang archive package headers could be written, that use the prefix field while at the same time setting the header format to GNU. This happens when numeric fields are big enough that they can not be written as octal strings and need to be written in binary. Usually, this shouldn't happen: uid, gid, devmajor, devminor can use up to 7 bytes, size and timestamp can use 11. If one of the records does overflow it switches the whole writer to GNU mode and all next files will be saved in GNU format.

Signed-off-by: Tonis Tiigi <[email protected]>
@tonistiigi tonistiigi force-pushed the fix-tar-prefix-header branch from 0063a23 to 4a3cfda Compare July 14, 2017 17:22
@tonistiigi
Copy link
Copy Markdown
Member Author

@thaJeztah Updated

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@dmcgowan
Copy link
Copy Markdown
Member

LGTM

Let's figure out a better way to handle this vendoring in a follow up. I don't think it is a big issue to create a repo with just archive/tar from the golang fork, as long as that repo is only updated from the golang fork and not maintained as a package fork.

Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

6 participants