From 7b2ec7fb2d13776ab02b63f32821519621b2c4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Mui=C3=B1o?= Date: Fri, 31 Jan 2014 14:48:06 +0100 Subject: [PATCH 1/2] Unit test ensuring that a tar.TypeXGlobalHeader does not cause an error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker-DCO-1.1-Signed-off-by: Abel Muiño (github: amuino) --- archive/archive_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/archive/archive_test.go b/archive/archive_test.go index a5629deff1..891f977dcf 100644 --- a/archive/archive_test.go +++ b/archive/archive_test.go @@ -1,6 +1,7 @@ package archive import ( + "archive/tar" "bytes" "fmt" "io" @@ -124,3 +125,14 @@ func TestTarUntar(t *testing.T) { } } } + +// Some tar archives such as http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev21.tar.gz +// use PAX Global Extended Headers. +// Failing prevents the archives from being uncompressed during ADD +func TestTypeXGlobalHeaderDoesNotFail(t *testing.T) { + hdr := tar.Header{Typeflag: tar.TypeXGlobalHeader} + err := createTarFile("pax_global_header", "some_dir", &hdr, nil) + if err != nil { + t.Fatal(err) + } +} From ce74c8b4d2e68256d85063ee237c8d41174b27c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abel=20Mui=C3=B1o?= Date: Fri, 31 Jan 2014 14:50:07 +0100 Subject: [PATCH 2/2] Ignore tar.TypeXGlobalHeader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker-DCO-1.1-Signed-off-by: Abel Muiño (github: amuino) --- archive/archive.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archive/archive.go b/archive/archive.go index 727e9289fa..b1400c2210 100644 --- a/archive/archive.go +++ b/archive/archive.go @@ -228,6 +228,10 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader) return err } + case tar.TypeXGlobalHeader: + utils.Debugf("PAX Global Extended Headers found and ignored") + return nil + default: return fmt.Errorf("Unhandled tar header type %d\n", hdr.Typeflag) }