Commit Graph

18 Commits

Author SHA1 Message Date
Alexandr Morozov be5bfbe221 Change path breakout detection logic in archive package
Fixes #9375

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-11-28 09:44:47 -08:00
Tibor Vass f6d9780229 archive: do not call FollowSymlinkInScope in createTarFile
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass 1852cc3841 archive: prevent breakout in Untar
Signed-off-by: Tibor Vass <teabee89@gmail.com>
2014-11-25 01:03:41 +02:00
Tibor Vass 221617dbcd archive: add breakout tests
Signed-off-by: Tibor Vass <teabee89@gmail.com>

Conflicts:
	pkg/archive/archive.go
		fixed conflict which git couldn't fix with the added BreakoutError

Conflicts:
	pkg/archive/archive_test.go
		fixed conflict in imports
2014-11-25 01:03:41 +02:00
unclejack 32ba6ab83c pkg/archive: fix TempArchive cleanup w/ one read
This fixes the removal of TempArchives which can read with only one
read. Such archives weren't getting removed because EOF wasn't being
triggered.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-20 19:34:35 +02:00
Ahmet Alp Balkan 2180aa4f6f Refactor pkg/archive with a platform-independent stat struct
pkg/archive contains code both invoked from cli (cross platform) and
daemon (linux only) and Unix-specific dependencies break compilation on
Windows. We extracted those stat-related funcs into platform specific
implementations at pkg/system and added unit tests.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Ahmet Alp Balkan 3d2fae353f Extract mknod, umask, lstat to pkg/system
Some parts of pkg/archive is called on both client/daemon code. To get
it compiling on Windows, these funcs are extracted into files with
build tags.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2014-11-14 18:20:54 -08:00
Steven Burgess 64a335ceac Fix comment to match the arg name
Signed-off-by: Steven Burgess <steven.a.burgess@hotmail.com>
2014-11-11 18:01:08 -05:00
unclejack 14692d0d41 pkg/archive: add interface for Untar
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-11-11 18:28:33 +02:00
Tibor Vass 6718791ea2 Merge pull request #8813 from jlhawn/aufs_exclude_on_tar_layer
Exclude `.wh..wh.*` AUFS metadata on layer export
2014-11-04 11:38:12 -05:00
Vincent Batts 5e02468e76 ./pkg/archive: clean up Stat_t assertion
inspired by @tonistiigi comment
(https://github.com/docker/docker/pull/8046/files#r19579960)

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2014-10-30 16:50:33 -04:00
Vincent Batts f14a9ed011 archive: cleanup and more information
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-10-29 14:52:59 -04:00
Vincent Batts f9f8044363 archive: preserve hardlinks in Tar and Untar
* integration test for preserving hardlinks

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2014-10-29 14:52:52 -04:00
Josh Hawn 0d97e082c3 Exclude `.wh..wh.*` AUFS metadata on layer export
In an effort to make layer content 'stable' between import
and export from two different graph drivers, we must resolve
an issue where AUFS produces metadata files in its layers
which other drivers explicitly ignore when importing.

The issue presents itself like this:

    - Generate a layer using AUFS
    - On commit of that container, the new stored layer contains
      AUFS metadata files/dirs. The stored layer content has some
      tarsum value: '1234567'
    - `docker save` that image to a USB drive and `docker load`
      into another docker engine instance which uses another
      graph driver, say 'btrfs'
    - On load, this graph driver explicitly ignores any AUFS metadata
      that it encounters. The stored layer content now has some
      different tarsum value: 'abcdefg'.

The only (apparent) useful aufs metadata to keep are the psuedo link
files located at `/.wh..wh.plink/`. Thes files hold information at the
RW layer about hard linked files between this layer and another layer.
The other graph drivers make sure to copy up these psuedo linked files
but I've tested out a few different situations and it seems that this
is unnecessary (In my test, AUFS already copies up the other hard linked
files to the RW layer).

This changeset adds explicit exclusion of the AUFS metadata files and
directories (NOTE: not the whiteout files!) on commit of a container
using the AUFS storage driver.

Also included is a change to the archive package. It now explicitly
ignores the root directory from being included in the resulting tar archive
for 2 reasons: 1) it's unnecessary. 2) It's another difference between
what other graph drivers produce when exporting a layer to a tar archive.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-10-28 10:14:05 -07:00
Alexandr Morozov ee7dd44c01 Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:11:48 -07:00
Alexandr Morozov 7c62cee51e Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
2014-10-24 15:03:06 -07:00
Brian Goff ef98fe0763 Make container.Copy support volumes
Fixes #1992

Right now when you `docker cp` a path which is in a volume, the cp
itself works, however you end up getting files that are in the
container's fs rather than the files in the volume (which is not in the
container's fs).
This makes it so when you `docker cp` a path that is in a volume it
follows the volume to the real path on the host.

archive.go has been modified so that when you do `docker cp mydata:/foo
.`, and /foo is the volume, the outputed folder is called "foo" instead
of the volume ID (because we are telling it to tar up
`/var/lib/docker/vfs/dir/<some id>` and not "foo", but the user would be
expecting "foo", not the ID

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2014-10-20 20:23:01 -04:00
Rafe Colton 30d5a42c1f Move archive package into pkg/archive
Now that the archive package does not depend on any docker-specific
packages, only those in pkg and vendor, it can be safely moved into pkg.

Signed-off-by: Rafe Colton <rafael.colton@gmail.com>
2014-09-29 23:23:36 -07:00
Renamed from archive/archive.go (Browse further)