Skip to content

Commit

Permalink
archive/tar: vendor again
Browse files Browse the repository at this point in the history
Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 7b30fd0)
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
kolyshkin authored and thaJeztah committed Apr 12, 2018
1 parent c208f1c commit 6672018
Show file tree
Hide file tree
Showing 12 changed files with 3,025 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile.simple
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
# will need updating, to avoid errors. Ping #docker-maintainers on IRC
# with a heads-up.
# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
ENV GO_VERSION 1.10.1
RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
| tar -xzC /usr/local
Expand Down
6 changes: 6 additions & 0 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,9 @@ github.com/Nvveen/Gotty a8b993ba6abdb0e0c12b0125c603323a71c7790c https://github.
github.com/docker/go-metrics d466d4f6fd960e01820085bd7e1a24426ee7ef18

github.com/opencontainers/selinux b29023b86e4a69d1b46b7e7b4e2b6fda03f0b9cd


# archive/tar (for Go 1.10, see https://github.com/golang/go/issues/24787)
# mkdir -p ./vendor/archive
# git clone -b go-1.10 --depth=1 [email protected]:kolyshkin/go-tar.git ./vendor/archive/tar
# vndr # to clean up test files
27 changes: 27 additions & 0 deletions vendor/archive/tar/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 changes: 27 additions & 0 deletions vendor/archive/tar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
This is a fork of Go 1.10 `archive/tar` package from the official
[repo](https://github.com/golang/go/tree/release-branch.go1.10/src/archive/tar),
with a partial [revert](https://github.com/kolyshkin/go-tar/commit/d651d6e45972363e9bb62b8e9d876df440b31628)
of upstream [commit 0564e304a6ea](https://github.com/golang/go/commit/0564e304a6ea394a42929060c588469dbd6f32af).
It is suggested as a replacement to the original package included with Go 1.10
in case you want to build a static Linux/glibc binary that works, and
can't afford to use `CGO_ENABLED=0`.

## Details

Using Go 1.10 [archive/tar](https://golang.org/pkg/archive/tar/) from a static binary
compiled with glibc on Linux can result in a panic upon calling
[`tar.FileInfoHeader()`](https://golang.org/pkg/archive/tar/#FileInfoHeader).
This is a major regression in Go 1.10, filed as
[Go issue #24787](https://github.com/golang/go/issues/24787).

The above issue is caused by an unfortunate combination of:
1. glibc way of dynamic loading of nss libraries even for a static build;
2. Go `os/user` package hard-coded reliance on libc to resolve user/group IDs to names (unless CGO is disabled).

While glibc can probably not be fixed and is not considered a bug per se,
the `os/user` issue is documented (see [Go issue #23265](https://github.com/golang/go/issues/23265))
and already fixed by [Go commit 62f0127d81](https://github.com/golang/go/commit/62f0127d8104d8266d9a3fb5a87e2f09ec8b6f5b).
The fix is expected to make its way to Go 1.11, and requires `osusergo` build tag
to be used for a static build.

This repository serves as a temporary workaround until the above fix is available.
Loading

0 comments on commit 6672018

Please sign in to comment.