Commit Graph

70 Commits

Author SHA1 Message Date
193c19b4a6 Merge pull request #4440 from infoxchange/aufs-permissions-4068
Create directories for tar files with relaxed permissions
Upstream-commit: ca3369dc8d5032e29452b354f1bcc9e10e39b917
Component: engine
2014-03-10 16:50:17 -07:00
519289ece2 Update bsd specs
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 6ccfb7fb9af207a9999c60e57d1c9486ca949a5e
Component: engine
2014-03-10 15:19:08 -07:00
66069773bc Merge branch 'master' into add_freebsd_support
Conflicts:
	archive/archive.go
	archive/start_unsupported.go
Upstream-commit: bb43761940848650c1eab3c097d826892bd5b140
Component: engine
2014-03-10 13:20:49 -07:00
42b0cd2529 Create pkg/system and move stuff there from archive
This is a package for generic system calls etc that for some reason
is not yet supported by "syscall", or where it is different enough
for the different ports to need portability wrappers.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: d6114c0da0e844199e3d23c60a04434566fb5392
Component: engine
2014-03-05 14:05:32 +01:00
2107371cbd Create directories for tar files with relaxed permissions
Docker-DCO-1.1-Signed-off-by: Alexey Kotlyarov <alexey@infoxchange.net.au> (github: koterpillar)
Upstream-commit: 2aeccdd3bb98760ab10e834c6c134bb76f664910
Component: engine
2014-03-04 16:15:52 +11:00
e3db7f47ed Use a more defensive vendored archive/tar import path to make it clear this isn't upstream's released archive/tar
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 2ca4e0ea60851ff8e9c0a05dc13fa23436c529b6
Component: engine
2014-02-27 09:43:44 -07:00
7d5d3a982f archive: Handle capabilities in tar files
If a file has a security.capability set, we push this to the tar file.
This is important to handle in e.g. layer files or when copying files
to containers, as some distros (e.g. Fedora) use capability bits as
a more finegrained version of setuid bits, and thus if the capabilites
are stripped (and setuid is not set) the binaries will fail to work.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 3b9953903b12eaca76655311bd44533768f6f3da
Component: engine
2014-02-20 09:23:34 +01:00
8cd94e7ac6 archive: Detect file changes to capability bits
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 87ca750cdc3114a340af1c5bc9394cc5f6242677
Component: engine
2014-02-20 09:23:34 +01:00
91e61d4022 archive: extract xattrs from tarfiles
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: c8428d77fdde41786aa5c0c4e64e0e762f873676
Component: engine
2014-02-20 09:23:34 +01:00
3d478c1043 Archive: Add Add Lgetxattr and Lsetxattr implementations
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: d19e998e7a99d24122da3e98d9886e3b7b4b3501
Component: engine
2014-02-20 09:23:34 +01:00
f829291e78 archive: Fix the storing of setuid bits, etc
In commit 3dfc910d7774d57c533b067fbe59d6b24dd803cd we changed from
syscall.Chmod() to os.Chmod(), but these take a different form of the
Mode argument. The sycall one takes the raw linux form, wheras
os.Chmod takes the os.FileMode form, and they differ for the higher
bits (setuid, setgid, etc). The raw tar header uses a form which
is compatible with the syscalls, but not the go calls.

We fix this by using hdr.FileInfo() which properly converts the mode
to what go expects.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 5ba24629610c27f08b54ff4c1f000ad6d787c156
Component: engine
2014-02-18 09:53:30 +01:00
e821f31734 archive: Handle aufs plink hardlinks in ApplyLayer
Files in the .wh..wh.plnk directory are ignored, but other files
inside the tarfile can be hardlinks to these files. This is not
something that normally happens, as on aufs unmount such files are
supposed to be dropped via the "auplink" too, yet images on the index
(such as shipyard/shipyard, e.g. layer
f73c835af6d58b6fc827b400569f79a8f28e54f5bb732be063e1aacefbc374d0)
contains such files.

We handle these by extracting these files to a temporary directory
and resolve such hardlinks via the temporary files.

This fixes https://github.com/dotcloud/docker/issues/3884

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 6889cd9f9cfa3a6439b7702d73f27ab3fac3d3ef
Component: engine
2014-02-17 20:46:32 +01:00
fc1f23f527 Add vendored archive/tar that includes xattrs patch
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: b762d3a7391dd526826a0a1f1c983ea5e54852f5
Component: engine
2014-02-17 08:20:21 -07:00
0f43c3eb05 Refactor utility MkBuildContext to the more generic archive.Generate
This facilitates refactoring commands.go.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 9b56da78e0b1e4e1da9b2bacc44a22143745a2b0
Component: engine
2014-02-15 14:52:08 -08:00
e12f62e6df Properly close archives
All archive that are created from somewhere generally have to be closed, because
at some point there is a file or a pipe or something that backs them. So, we
make archive.Archive a ReadCloser. However, code consuming archives does not
typically close them so we add an archive.ArchiveReader and use that when we're
only reading.

We then change all the Tar/Archive places to create ReadClosers, and to properly
close them everywhere.

As an added bonus we can use ReadCloserWrapper rather than EofReader in several places,
which is good as EofReader doesn't always work right. For instance, many compression
schemes like gzip knows it is EOF before having read the EOF from the stream, so the
EofCloser never sees an EOF.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: f198ee525ad6862dce3940e08c72e0a092380a7b
Component: engine
2014-02-14 13:46:17 +01:00
12b909af88 archive.TarFilter() - properly close readers
CompressStream() now always returns a stream that is closable, and it never
closes the underlying writer. TarFilter() makes sure the decompressed stream
is closed at the and, as well as the PipeWriter.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 804690bd07dcc1da6d0707d081e40ec9a189a3b6
Component: engine
2014-02-14 12:56:55 +01:00
77b539f03c archive: Close decompressed streams
Various kinds of decompressed streams are really ReadClosers. For instance
gzip.NewReader() is, and the one returned from CmdStream is changed to be
because it returns a PipeReader which is a ReadCloser.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 0d9213f859e00459e9efee2c5164417c94d66d2f
Component: engine
2014-02-14 12:56:55 +01:00
de9b1efd2f Remove linux specific calls
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 3dfc910d7774d57c533b067fbe59d6b24dd803cd
Component: engine
2014-02-09 04:23:57 -08:00
0060932995 Remove linux specific calls
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: e8740685ceb3ad8637532e7ddffb84ea55d4fc27
Component: engine
2014-02-06 14:13:03 -08:00
31578849e3 Merge pull request #3868 from 1uptalent/3867-allow-pax-global-extended-headers-to-passthrough
FIX 3867 allow pax global extended headers to passthrough
Upstream-commit: f9b4146ad48f992d17ca8aa530ab5bef75400c31
Component: engine
2014-01-31 17:54:08 -08:00
094438868d Ignore tar.TypeXGlobalHeader
Docker-DCO-1.1-Signed-off-by: Abel Muiño <amuino@gmail.com> (github: amuino)
Upstream-commit: ce74c8b4d2e68256d85063ee237c8d41174b27c3
Component: engine
2014-01-31 14:57:30 +01:00
dcb9b96902 Unit test ensuring that a tar.TypeXGlobalHeader does not cause an error
Docker-DCO-1.1-Signed-off-by: Abel Muiño <amuino@gmail.com> (github: amuino)
Upstream-commit: 7b2ec7fb2d13776ab02b63f32821519621b2c4e8
Component: engine
2014-01-31 14:57:18 +01:00
e8f6d5eb59 Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 065dd231dd7d7858df982a8decfade9df936cf63
Component: engine
2014-01-31 03:16:42 -07:00
185286d85e Remove all darwin specific files and use more generic _unsupported with build tags.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 45dd051e8ee2e0e18d8ffec99f65878c20bd11e9
Component: engine
2014-01-30 23:10:56 +00:00
0341842338 archive: Always end directory filenames in tars with /
This matches what tar does, and without it the tarsum created
by the registry will not match the docker one.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: f918fca3bf77ebe5845593281382f68e5b166ab3
Component: engine
2014-01-21 12:52:05 +01:00
f075178b2b Implement TarFilter in go, rather than calling out to tar
This uses a plain filepath.Walk + addTarFile to create a tar file,
optionially compressing it with gzip.

Unfortunately go only has gzip compression support, not bzip2 or xz.
However, this is not a regression, as docker currently uses *no*
compression for TarFilter(). The only compression of tarfiles
currently happens in utils/tarsum.go, and that manually does gzip
compression.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 5ea48aa7f8d3839877b869fdfcea2d5de0972fbf
Component: engine
2014-01-20 20:26:20 +01:00
2a219597ed Simplify addTarFile
We can use tar.FileInfoHeader to do much of the work.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: bab8efbf050e1bc2d5c2ff64c6161ef4d323bc3f
Component: engine
2014-01-20 20:26:20 +01:00
0762ca65d0 archive: Extract code from ExportChanges to addTarFile()
This is the code that takes a normal file and adds it to a TarWriter.
We extract it so that we can share it with Tar().

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 5b77e51e0a15eddefcb40380673df8c0c24f95d1
Component: engine
2014-01-20 20:26:20 +01:00
e8d9d10625 archive: Remove unused features
This simplifies that code that calls out to tar by removing support
for now unused features.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 4fb1db7f742fb34a7a06621d0698063de87a572c
Component: engine
2014-01-20 20:26:20 +01:00
d4c3241336 Merge pull request #3292 from alexlarsson/export-changes-manual
Don't shell out to tar for ExportChanges
Upstream-commit: b563c0c02b563d72f32a4e4c6fac5aaba34bc287
Component: engine
2014-01-20 11:08:16 -08:00
2deb48fe38 Fix cross compile
stat.Rdev and time.* is 32bit on OSX, which breaks cross builds with eg:
cannot use stat.Rdev (type int32) as type uint64 in function argument

We fix this with an extra conversion to uint64.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: ba52130873395a44d637fc57f98ed174f0ac87bb
Component: engine
2014-01-17 11:01:28 +01:00
d37b5ad2d1 Implement UnTar via archive/tar
This replaces the shelling out to tar with a reimplementation of untar
based on the archive/tar code and the pre-existing code from ApplyLayer
to create real files from tar headers.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: a4868e233c7ebce259fc02d3dbfb241c23471a4a
Component: engine
2014-01-14 11:21:29 +01:00
f97f40c214 archive: Extract createTarFile() from ApplyLayer
This way we can reuse it for Untar()

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 710d5a48fb751623fbf77a51b89f2dfbf0edac68
Component: engine
2014-01-14 11:21:07 +01:00
692720d854 Don't shell out to tar for ExportChanges
This changes ExportChanges to use the go tar support so we can
directly create tar layer files. This has several advantages:

* We don't have to create the whiteout files on disk to get them
  added to the layer

* We can later guarantee specific features (such as xattrs) being
  supported by the tar implementation.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: d54ce8087aba23663856c81a3fb5475979bdf453
Component: engine
2014-01-13 13:36:11 +01:00
d253920583 Revert "Add -S option to tar for efficient sparse file handling"
This reverts commit 733bf5d3ddbfb6dba7c2c0996c4af47a765e4593.

This is needed to fix "no such file" errors `docker build` errors for
devicemapper.

This fixes issue #3449.

Docker-DCO-1.0-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: d003cfea25c276904dbe1e972c0cf71d5c25e689
Component: engine
2014-01-08 02:58:39 +02:00
c075e98c4c Make CopyFileWithTar use a pipe instead of a buffer. Save more than 1Gb of ram for a 500Mb file.
Upstream-commit: 444a087ac2ca34776b2b3e4433aa35c27cdfd57a
Component: engine
2014-01-06 17:44:22 -08:00
044c307631 small batch of edits/corrections to comments
Upstream-commit: 0fccf0f68655fd01973e4c00bbb063fad1bce56c
Component: engine
2013-12-24 16:40:14 -08:00
e69eef70c1 Add -S option to tar for efficient sparse file handling
Fixes issue #3282
Upstream-commit: 733bf5d3ddbfb6dba7c2c0996c4af47a765e4593
Component: engine
2013-12-19 21:41:22 -08:00
3222062547 archive: Re-add XZ compression support
This shells out to the xz binary to support .tar.xz layers, as
there is no compression/xz support in go.
Upstream-commit: b8a4f570fb31091f43caeba5b824ae38a5bc69e8
Component: engine
2013-12-18 10:50:22 +01:00
c725c9d310 Handle compressed tars in ApplyLayer
When pulling from a registry we get a compressed tar archive, so
we need to wrap the stream in the right kind of compress reader.

Unfortunately go doesn't have an Xz decompression method, but I
don't think any docker layers use that atm anyway.
Upstream-commit: a96a26c62f6333e61134759256db43a7f5946631
Component: engine
2013-12-17 14:19:48 +01:00
692e7bb3bd ApplyLayer: Fix TestLookupImage
The TestLookupImage test seems to use a layer that contains
/etc/postgres/postgres.conf, but not e.g. /etc/postgres.

To handle this we ensure that the parent directory always
exists, and if not we create it.
Upstream-commit: 78c22c24b353d77fdab3e1616d9986a8ae95a7c2
Component: engine
2013-12-16 14:35:43 +01:00
7bf68dd3de Re-enable TestApplyLayer
With the previous two changes we now pass this test.
Upstream-commit: a8af12f80a4a1678988b4667e5211d4e576ce903
Component: engine
2013-12-13 15:50:25 +01:00
51b58640b0 Fix change detection when applying tar layers
The default gnu tar format has no sub-second precision mtime support,
and the golang tar writer currently doesn't support that either.
This means if we export the changes from a container we will not
get zeron in the sub-second precision field when the change is applied.

This means we can't compare that to the original without getting a
spurious change. So, we detect this case by treating a case where the
seconds match and either of the two nanoseconds are zero as equal.
Upstream-commit: 10cd902f900392a2f10a6f8763bba70607ea0d41
Component: engine
2013-12-13 15:46:41 +01:00
e5d96fb523 archive: Implement ApplyLayer directly
Rather than calling out to tar we use the golang tar parser
to directly extract the tar files. This has two major advantages:

1) We're able to replace an existing directory with a file in the
   new layer. This currently breaks with the external tar, since
   it refuses to recursively remove the destination directory in
   this case, and there are no options to make it do that.

2) We avoid extracting the whiteout files just to later remove them.
Upstream-commit: 818c249bae8d29842834bf765299c86c09e6913e
Component: engine
2013-12-13 15:43:50 +01:00
26d7cf1b0c fixed some go vet issues.
Upstream-commit: a6c9a332d040a98c5cf4325491fc8d9aa7e5475b
Component: engine
2013-11-29 22:53:20 -02:00
3f2a763338 Move syscall.Stats logic to os specific file.
related to #2909.
Upstream-commit: 8b2a7e35c35f894dca0795a4fde9ec0cfe04ce43
Component: engine
2013-11-28 00:22:47 -02:00
116f6db1b3 Set consistent time for sample dir in archive test
Upstream-commit: 0d1b5d767648ee6200a816786e51d23917bf0218
Component: engine
2013-11-25 19:58:14 -08:00
cf0c94cbee Merge pull request #48 from crosbymichael/reset-mtime
Ensure same atime, mtime after applying whiteouts
Upstream-commit: 91330243b53c5340c80d132379d0e97f2fb0c771
Component: engine
2013-11-19 15:40:12 -08:00
b6950e3878 Merge branch 'master' into creack-merge-master
Conflicts:
	api_params.go
	graph.go
	graph_test.go
	image.go
	integration/api_test.go
	integration/container_test.go
	integration/runtime_test.go
	runtime.go
Upstream-commit: 28d4cbbc59e419f00c1ad75991b106241933ca5d
Component: engine
2013-11-19 14:58:12 -08:00
99bee9426b Implement fallback for getting the size of a container
This moves Driver.Size() to Differ.DiffSize(), removing the empty
implementations in devmapper and dummy, and renaming the one in aufs.

Then we fall back to a container.Changes() implementation in the non-aufs
case.
Upstream-commit: 5d76681c3d0cbb744205a397420603ce029ce754
Component: engine
2013-11-19 10:36:54 +01:00