Commit graph

92 commits

Author SHA1 Message Date
LK4D4
f08cd445b0 Fix go vet errors
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-06-18 17:39:57 +00:00
unclejack
b64209f7b6 reuse timestamp, don't call time.Now() 3 times
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-05-31 03:03:51 +03:00
Victor Vieux
9e51b7abae ignore lchown error on docker cp
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
2014-05-21 00:23:17 +00:00
Timothy
28fc387cf0 Add readme file for the archive directory
See issue #5873

Docker-DCO-1.1-Signed-off-by: Timothy <timothyhobbs@seznam.cz> (github: https://github.com/timthelion)
2014-05-17 17:48:07 +00:00
Guillaume J. Charmes
6f651ec62b Merge pull request #5851 from proppy/archive-simple-detect
archive: simplify DetectCompression
2014-05-16 16:32:55 -07:00
Michael Crosby
eb61a1f73a Merge pull request #5822 from creack/update_vendors
Update archive/tar vendored
2014-05-16 16:31:37 -07:00
Johan Euphrosine
4a3aefbb52 archive: add missing bytes package
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
2014-05-16 16:26:28 -07:00
Johan Euphrosine
67ce59a806 archive: fix panic if len(source) < len(m)
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
2014-05-16 16:25:56 -07:00
Johan Euphrosine
3118952e0a archive: simplify DetectCompression
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
2014-05-16 16:25:56 -07:00
Victor Vieux
1adc2fa533 Merge pull request #5853 from proppy/update-tarfilter-comment
archive: update TarFilter comments
2014-05-16 13:06:12 -07:00
Johan Euphrosine
311614952e archive: update TarFilter comments
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
2014-05-16 12:44:42 -07:00
Guillaume J. Charmes
4353ee78e8 Merge pull request #5454 from kzys/utime-omit
UTIME_OMIT is only available on Linux
2014-05-15 17:18:37 -07:00
Guillaume J. Charmes
aedcb76adc
Add test for invalid tarball read
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
2014-05-15 15:45:40 -07:00
Johan Euphrosine
77c2b76e44 archive: use bufio for compression detection
Docker-DCO-1.1-Signed-off-by: Johan Euphrosine <proppy@google.com> (github: proppy)
2014-05-15 11:41:07 -07:00
unclejack
359f8aca29 process directories in parallel in ChangesDirs
This commit lowers the total time spent in ChangesDirs to half during a
commit.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-05-15 00:03:33 +03:00
LK4D4
91b7d8ebd3 Change owner only on copied content
Fixes #5110
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
2014-05-07 20:40:22 +04:00
Kato Kazuyoshi
21b42dfcfd UTIME_OMIT is only available on Linux
Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
2014-04-29 09:08:33 +09:00
Kato Kazuyoshi
e1e512e2da This permission should be interpreted as octal, not decimal
Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
2014-04-17 00:48:27 +09:00
Victor Vieux
73a22fc6b3 Merge pull request #5039 from kzys/freebsd-timestamp
Don't assume the file system has sub-second precision timestamp
2014-04-07 10:28:22 -07:00
Kato Kazuyoshi
794b5de749 Don't assume the file system has sub-second precision timestamp
For example, FreeBSD doesn't have that
(see http://lists.freebsd.org/pipermail/freebsd-fs/2012-February/013677.html).

Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
2014-04-05 10:30:37 +09:00
Kato Kazuyoshi
da8aa712d2 Remove archive/stat_unsupported.go because it is not used
LUtimesNano and all other functions were implemented on pkg/system after
d6114c0da0.

Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
2014-04-05 10:09:04 +09:00
Vincent Batts
367a679b92 images: assurance and debug info on image layers
when pushing or saving layers, report sizes for validation. And ensure
that the files written are sync'ed.

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
2014-03-19 14:34:12 -04:00
Michael Crosby
ca3369dc8d Merge pull request #4440 from infoxchange/aufs-permissions-4068
Create directories for tar files with relaxed permissions
2014-03-10 16:50:17 -07:00
Guillaume J. Charmes
6ccfb7fb9a
Update bsd specs
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-03-10 15:19:08 -07:00
Guillaume J. Charmes
bb43761940
Merge branch 'master' into add_freebsd_support
Conflicts:
	archive/archive.go
	archive/start_unsupported.go
2014-03-10 13:20:49 -07:00
Alexander Larsson
d6114c0da0 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)
2014-03-05 14:05:32 +01:00
Alexey Kotlyarov
2aeccdd3bb Create directories for tar files with relaxed permissions
Docker-DCO-1.1-Signed-off-by: Alexey Kotlyarov <alexey@infoxchange.net.au> (github: koterpillar)
2014-03-04 16:15:52 +11:00
Tianon Gravi
2ca4e0ea60 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)
2014-02-27 09:43:44 -07:00
Alexander Larsson
3b9953903b 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)
2014-02-20 09:23:34 +01:00
Alexander Larsson
87ca750cdc archive: Detect file changes to capability bits
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-20 09:23:34 +01:00
Alexander Larsson
c8428d77fd archive: extract xattrs from tarfiles
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-20 09:23:34 +01:00
Alexander Larsson
d19e998e7a Archive: Add Add Lgetxattr and Lsetxattr implementations
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-20 09:23:34 +01:00
Alexander Larsson
5ba2462961 archive: Fix the storing of setuid bits, etc
In commit 3dfc910d77 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)
2014-02-18 09:53:30 +01:00
Alexander Larsson
6889cd9f9c 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)
2014-02-17 20:46:32 +01:00
Tianon Gravi
b762d3a739 Add vendored archive/tar that includes xattrs patch
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-02-17 08:20:21 -07:00
Solomon Hykes
9b56da78e0 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)
2014-02-15 14:52:08 -08:00
Alexander Larsson
f198ee525a 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)
2014-02-14 13:46:17 +01:00
Alexander Larsson
804690bd07 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)
2014-02-14 12:56:55 +01:00
Alexander Larsson
0d9213f859 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)
2014-02-14 12:56:55 +01:00
Guillaume J. Charmes
3dfc910d77
Remove linux specific calls
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-02-09 04:23:57 -08:00
Guillaume J. Charmes
e8740685ce
Remove linux specific calls
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-02-06 14:13:03 -08:00
Guillaume J. Charmes
f9b4146ad4 Merge pull request #3868 from 1uptalent/3867-allow-pax-global-extended-headers-to-passthrough
FIX 3867 allow pax global extended headers to passthrough
2014-01-31 17:54:08 -08:00
Abel Muiño
ce74c8b4d2 Ignore tar.TypeXGlobalHeader
Docker-DCO-1.1-Signed-off-by: Abel Muiño <amuino@gmail.com> (github: amuino)
2014-01-31 14:57:30 +01:00
Abel Muiño
7b2ec7fb2d 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)
2014-01-31 14:57:18 +01:00
Tianon Gravi
065dd231dd 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)
2014-01-31 03:16:42 -07:00
Guillaume J. Charmes
45dd051e8e 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)
2014-01-30 23:10:56 +00:00
Alexander Larsson
f918fca3bf 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)
2014-01-21 12:52:05 +01:00
Alexander Larsson
5ea48aa7f8 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)
2014-01-20 20:26:20 +01:00
Alexander Larsson
bab8efbf05 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)
2014-01-20 20:26:20 +01:00
Alexander Larsson
5b77e51e0a 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)
2014-01-20 20:26:20 +01:00