Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Conversation

@zhsj
Copy link
Contributor

@zhsj zhsj commented Feb 26, 2018

fix tar header format after manipulating the Name and Linkname.

Fixes: #259

@zhsj
Copy link
Contributor Author

zhsj commented Feb 26, 2018

The Format field is exposed since Go 1.10, should the CI bump its Go version?

@lucab
Copy link
Contributor

lucab commented Apr 12, 2018

Thanks for the PR. While we can definitely bump the CI environment, it sounds like this would introduce an hard requirement on go >= 1.10 for all library consumers. Is there no other way to achieve the same?

@zhsj
Copy link
Contributor Author

zhsj commented Apr 12, 2018

As long as it uses archive/tar, I don't find other way to workaround. But if you don't want to enforce docker2aci depending go1.10, I can change the PR to use build profile(like separating the fixture to a function, and only building that function on go1.10), but it looks ugly...

@lucab
Copy link
Contributor

lucab commented Apr 12, 2018

@iaguis any feedback? I would typically wait till 1.9 goes out of support (i.e. August 2018), but at the same time this seems worth fixing in a shorter term.

@zhsj
Copy link
Contributor Author

zhsj commented Apr 12, 2018

Reading the reference issue on coreos/bugs#2402, it seems docker2aci on CoreOS 1688.5.3 not affected by this. However I don't use CoreOS, not sure what version the docker2aci it uses. If this is a regression in docker2aci, then we can fix it without bumping Go dependency to 1.10.

@zhsj
Copy link
Contributor Author

zhsj commented Apr 12, 2018

As suggested in the issue of Go, I changed the PR to copy Header struct.

After manipulating the Name and Linkname, the orignal Header format may
be invalid.

Starting from Go 1.10, the Header format is stored in the Header struct.

>For forward compatibility, users that retrieve a Header from Reader.Next,
>mutate it in some ways, and then pass it back to Writer.WriteHeader should
>do so by creating a new Header and copying the fields that they are
>interested in preserving.

The copied fields are taken from all the fields presented in Go 1.6.

Ref: golang/go#24821
Closes: appc#259
Signed-off-by: Shengjing Zhu <[email protected]>
Copy link
Contributor

@lucab lucab left a comment

Choose a reason for hiding this comment

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

LGTM

@lucab lucab merged commit dff7c94 into appc:master Apr 13, 2018
@zhsj zhsj deleted the fix-tar branch April 13, 2018 15:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: conversion error: error generating ACI: archive/tar: cannot encode header

2 participants