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
archive/tar: overlong linkname and USTAR header, go-1.10 behavioral change/regression #24821
Comments
This downgrade the golang toolchain used to build rkt, keeping it at go1.9. This is a temporary workaround for a go-1.10 regression in `archive/tar`. Ref: coreos/bugs#2402 Ref: appc/docker2aci#259 Ref: golang/go#24821
This downgrades the golang toolchain used to build rkt, keeping it at go1.9. This is a temporary workaround for a go-1.10 regression in `archive/tar`. Ref: coreos/bugs#2402 Ref: appc/docker2aci#259 Ref: golang/go#24821
This downgrades the golang toolchain used to build rkt, keeping it at go1.9. This is a temporary workaround for a go-1.10 regression in `archive/tar`. Ref: coreos/bugs#2402 Ref: appc/docker2aci#259 Ref: golang/go#24821
Hi, thanks for the report. The heuristics that The error you are getting seems seems to show that this is working as intended. The header was read in (as USTAR presumably), modified in some way, and written back out. Only the modification happened in such a way that it went beyond the limitations of USTAR, and so the Writer rightly complains that it can't use USTAR anymore. As a general rule of thumb, the read-modify-write cycle on a
However, this observation has held even prior to G1.10 and was documented to encourage more forward compatible uses of tar. |
After manipulating the Name and Linkname, the orignal Header format may be invalid. Start 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 <i@zhsj.me>
Thanks for the quick response. So the outcome seems to be that this breaking regression is a unfortunate by-product of the package rework, but it is intended to stay and consumers should deploy their own toolchain-dependent fixes, right? As much as I appreciate the technical rework and I am fine with fixing the consumers, I'd like to point out that this explicitly goes against the Go 1 promise: If |
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 <i@zhsj.me>
It's here to stay unless there's a clean fix that addresses the problem, but I don't see one. I don't think it's fair to only quote that part of the Go1 compatibility promise. Below that statement is list of conditions:
The general issue regarding tar output format has been straddling the lines between unspecified behavior and downright buggy behavior. As a result, the inability to specify the desired format has been the source of more bugs. The |
That makes sense. Sorry if my comment sounded harsh/unfair, it wasn't meant to. I'm going ahead closing this bug and fixing the consuming code. Thanks for your work and feedback! |
Sounded respectful to me. Thanks for raising the issue. Knowing that a read-modify-write use-case exists helps guide design decisions in the future. |
This downgrades the golang toolchain used to build rkt, keeping it at go1.9. This is a temporary workaround for a go-1.10 regression in `archive/tar`. Ref: coreos/bugs#2402 Ref: appc/docker2aci#259 Ref: golang/go#24821
Go version
Any older toolchain (e.g. go1.9) is not affected by this bug.
Bug output/reproducer
Reproducer:
Error:
Additional info
It looks like the
archive/tar
rework in go-1.10 introduced a regression in header format when an overlong filename/linkname is present.This affects docker2aci, as rebuilding the same sourcecode with a newer toolchain results in a runtime error. Please note that the consuming code doesn't try to enforce USTAR, and just relies on
archive/tar
heuristics.This can be in theory easily workarounded on our side (see https://github.com/appc/docker2aci/pull/260/files), but this behavioral change likely affects other projects as well and addressing it will introduce toolchain-specific codepaths.
I think it should be investigated and possibly addressed in
archive/tar
itself./cc @dsnet @zhsj
The text was updated successfully, but these errors were encountered: