25 Commits
Author SHA1 Message Date
Jonathan Boulle c5430a4ee5 test: add check for license header
Dumb test looking for either a Copyright header or sign that the file
was autogenerated (e.g. by `go generate`) in all non-Godep .go files.

Also moves the actual unit/functional tests after the pre-flight checks
(gofmt, go vet, this new check)
2015-05-29 10:16:22 -07:00
Simone Gotti 2c66843cc1 aci: extract tar in chroot
this introduces tar extraction inside a chroot. This is done spawning a
new process. Instead of creating a new executable (difficult to find,
package etc...) it adds the concept of a multicall process (like busybox).

Now a new multicall command "extracttar" is added.
tar.ExtractTar executes this new command passing a pipe to send the
filesMap and the tar contents to stdin.

The incomplete "insecure link" checks are removed from the the tar
functions.  Additionally these functions are now not exported and the
extraction directory is always the root directory.
2015-05-26 23:40:36 +02:00
Jonathan Boulle 9685f37575 *: adjust copyright header
Inspired by a similar change in the Kubernetes project [1], this changes
the copyright header to the more generic "The rkt Authors" rather than
"CoreOS, Inc.", which is only sometimes correct.

https://github.com/GoogleCloudPlatform/kubernetes/commit/6b3a6e6b983f967c88d14d26542ec6e30c49ebd3
2015-05-03 14:29:15 -07:00
Jonathan Boulle 79753c9b19 *: rocket -> rkt 2015-03-31 16:31:21 -07:00
Simone Gotti b5fb9522b9 tar: restore files mtime and atime. 2015-03-16 09:59:50 +01:00
Dardo D Kleiner dedc97f2f3 pkg/tar: implement tar.TypeFifo 2015-03-12 12:55:02 -04:00
Simone Gotti 022b9bc4c8 tar: call os.Chmod after os.LChown
Fix the TODO introduced and discussed in #462 calling os.Chmod after the
os.LChown for all files except symlinks.
2015-02-16 10:23:40 +01:00
Simone Gotti 3b8276065c tar: restore entry's uid and gid.
Restore the extracted entry uid and gid. This uses tar header Uid and Gid
values and ignores header's Uname and Gname.

As the tests are usually run as a unprivileged user the generated test tars'
entries are defaulted to the running user uid and gid. For this reason tests
are implictly verifing that the os.Chown/os.LChows calls works but it's
difficult to create a more comprehensive test using different uid and gid
values.
2015-02-03 21:49:12 +01:00
Jonathan Boulle 6d58c1fd17 *: add missing godocs and copyright headers
Also moves pkg/util/aci.go -> pkg/aci/aci.go for simplicity and
consistency with the other pkgs.
2015-01-24 19:03:56 -08:00
Simone Gotti 77c6331669 pkg/tar: add overwrite option to ExtractTar.
Add an overwrite option to ExtractTar so, calling the function on a non empty
directory, will overwrite existing files instead of returning an error.

It's needed during ACI rendering, as (in the actual implementation), extracting
a dependency list of ACIs over the same directory, the files provided by the
next ACI in the list have to overwrite the ones previously extracted.
2015-01-13 00:14:37 +01:00
Jonathan Boulle 73ad65ae6d Merge pull request #349 from sgotti/tarpathwhitelist
pkg/tar: add PathWhitelistMap to whitelist files for tar extraction.
2015-01-10 19:07:25 -08:00
Jonathan Boulle 798f3d11af pkg/tar: fix typos in docstrings 2015-01-10 17:53:03 -08:00
Simone Gotti 5c989ccb31 pkg/tar: add PathWhitelistMap to whitelist files for tar extraction. 2015-01-10 16:55:58 +01:00
Simone Gotti ab3a7ff5f0 pkg/tar: add an ExtractFileFromTar function to extract a single file to a byte slice. 2015-01-10 15:10:29 +01:00
Simone Gotti d25a0416ca pkg/tar: create a function for single tar file extraction so it can be reused by
different tar extraction functions.
2015-01-09 09:33:25 +01:00
gprggr 4195360f21 pkg/tar: tar_test did not remove tmpdir 2014-12-30 22:40:53 +01:00
gprggr 76bacb4556 pkg/tar: tar_test.go - fixing possible nil pointer dereference
Playing a little with tar.go caused a panic in tar_test.go. This fixes it.
2014-12-30 13:23:59 +01:00
Jonathan Boulle 6dece1122d *: add license header to all source files
h/t @johndeng for raising this in #305
2014-12-29 17:34:05 -08:00
gprggr f2d4f67b4b Update tar.go
If os.OpenFile(...) returns err != nil, f will be nil. So f.Close() would cause a "nil pointer dereference".
2014-12-29 21:54:18 +01:00
Simone Gotti cd02542963 Create parent directories for every file type and not for only regular files. 2014-12-12 10:24:41 +01:00
Máximo Cuadros Ortiz 31d332cbc1 tar: ensuring dir mode extraction 2014-12-11 18:30:07 -08:00
Máximo Cuadros Ortiz 8dd5f9fdab tar: fixing extracting files that are dirs https://github.com/coreos/rocket/issues/250 2014-12-11 18:30:07 -08:00
Simone Gotti 13ef488529 Fix creation of HardLinks. The LinkName of an hardlink is relative to the tar's root. 2014-12-03 12:16:55 +01:00
Kelsey Hightower e9e3954259 tar: catch insecure links in the container image
Container images may contain soft and hard links that "break out"
of the container. Check for insecure links when extracting the
container image.
2014-11-28 18:13:56 -08:00
Jonathan Boulle aa3b059e6e *: split ExtractTar out into pkg 2014-11-27 11:26:16 -08:00