Commit Graph

34 Commits

Author SHA1 Message Date
5cdc9005f7 pkg/tarsum: delete the logging code
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: e7c0587d541cd9f224df622b2f97c918e68cfb05
Component: engine
2014-12-18 23:38:26 +02:00
7f9567ff56 Merge pull request #9099 from vbatts/vbatts-tarsum_spec
pkg/tarsum: specification on TarSum checksum algorithm
Upstream-commit: 428c263a6c2a0606a5eed25beaf2ef93da14a4b7
Component: engine
2014-12-10 10:24:48 -08:00
9d37d55377 Correctly close generated benchmark archives
Another update to TarSum tests, this patch fixes an issue where
the benchmarks were generating archives incorrectly by not closing
the tarWriter.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 385917e22c5bd0d577a5a0be0de9e88a0499fe87
Component: engine
2014-12-03 22:26:06 -08:00
54cbb45483 Correct TarSum benchmarks: 9kTar and 9kTarGzip
These two cases did not actually read the same content with each iteration
of the benchmark. After the first read, the buffer was consumed. This patch
corrects this by using a bytes.Reader and seeking to the beginning of the
buffer at the beginning of each iteration.

Unfortunately, this benchmark was not actually as fast as we believed. But
the new results do bring its results closer to those of the other benchmarks.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 92fd49f7ca42cf5d97825853034eac685b90fc1d
Component: engine
2014-12-03 10:44:05 -08:00
efbc3f4d55 Fix TarSum iteration test
I noticed that 3 of the tarsum test cases had expected a tarsum with
a sha256 hash of
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
As I've been working with sha256 quite a bit lately, it struck me that
this is the initial digest value for sha256, which means that no data
was processed. However, these tests *do* process data. It turns out that
there was a bug in the test handling code which did not wait for tarsum
to end completely. This patch corrects these test cases.

I'm unaware of anywhere else in the code base where this would be an issue,
though we definitily need to look out in the future to ensure we are
completing tarsum reads (waiting for EOF).

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 8d9e25dbddc189f4094e0f25a90f2b8a25deec9d
Component: engine
2014-12-02 15:28:13 -08:00
fb0b016635 pkg/tarsum: add maintainers & add missing s
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: 3db5ea1617549bbef7f645d4ecbf482ad1f31c71
Component: engine
2014-11-26 00:44:16 +02:00
ce14110804 tarsum: updates for jamtur01 comments
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 7f84174109b734fac309c02e4b474aeff9dfca15
Component: engine
2014-11-24 23:18:48 -05:00
230f6a737f pkg/tarsum: review cleanup
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 3d6e63e0c4bab556fb8bd0abb65e4f7af35256fd
Component: engine
2014-11-24 23:18:48 -05:00
69cf264910 pkg/tarsum: review amendments
(separate commit to preserve github conversation)

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 3e08fb5ad2b882b12a396e258bc745254fac6f51
Component: engine
2014-11-24 23:18:48 -05:00
b9ee0de7eb pkg/tarsum: specification on TarSum checksum
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: f30fee69b14a5fd9df9abb00498f2aff6e378bbe
Component: engine
2014-11-24 23:18:47 -05:00
664428ef8f Merge pull request #9086 from vbatts/vbatts-tarsum_more_tests
pkg/tarsum: adding more tests
Upstream-commit: e820365b677cff6a5f3b073da1a3ebb21e5f8247
Component: engine
2014-11-21 17:12:55 -08:00
b6be906192 Add unit test for tarSum.Sum() with no data
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: e257863a9a2bff19c66355230483a8b6fa9de209
Component: engine
2014-11-19 15:55:21 -05:00
3898f51483 pkg/tarsum: actually init the TarSum struct
closes #9241

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 6a74f071afb4a69a1360ff1e84945745e578c349
Component: engine
2014-11-19 15:46:03 -05:00
184d9e7149 pkg/tarsum: adding more tests
Ensuring case size of headers will still be accounted for.
https://github.com/docker/docker/pull/8869#discussion_r20114401

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 5cd9b7513f05948ddc1068041f6c6d822875921e
Component: engine
2014-11-11 08:48:11 -05:00
ed13d0fdd5 Finalize TarSum Version 1 w/ refactor
The current Dev version of TarSum includes hashing of extended
file attributes and omits inclusion of modified time headers.

I refactored the logic around the version differences to make it
more clear that the difference between versions is in how tar
headers are selected and ordered.

TarSum Version 1 is now declared with the new Dev version continuing
to track it.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: a7aa2c8ad26149e9be753bc08964f35cb09d313c
Component: engine
2014-11-04 21:38:52 -08:00
2d56e3cbc6 Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 7c62cee51edc91634046b4faa6c6f1841cd53ec1
Component: engine
2014-10-24 15:03:06 -07:00
3443a67be3 pkg/tarsum: fix panic with dynamic buffer
When read is called on a tarsum with a two different read sizes, specifically the second call larger than the first, the dynamic buffer does not get reallocated causing a slice read error.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 5cdf7f507771e159ddd335f3757cd33f7ba4e426
Component: engine
2014-09-25 15:58:35 -07:00
e5b81f13f8 tarsum: allow for alternate block ciphers
Not breaking the default cipher and algorithm for calculating checksums,
but allow for using alternate block ciphers during the checksum
calculation.

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
Upstream-commit: 4e9925d780665149b8bc940d5ba242ada1973c4e
Component: engine
2014-09-18 10:34:58 -04:00
b0b8a2773b tarsum: name collision fix
If a tar were constructed with duplicate file names, then depending on
the order, it could result in same tarsum.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: c5e6362c53cbbc09ddbabd5a7323e04438b57d31
Component: engine
2014-09-17 14:37:46 -04:00
c4f90f34f5 Merge pull request #8063 from jlhawn/tarsum_empty_tar_archive
tarsum: correct close and finish reads
Upstream-commit: 0a6fd743ea7b0b312620e8b0f51d576a3f71f07c
Component: engine
2014-09-16 15:41:28 -04:00
b6e3f16eca Correct tarsum finish logic
Tarsum now correctly closes the internal TarWriter which appends
a block of 1024 zeros to the end of the returned archive.

Signed-off-by: Josh Hawn <josh.hawn@docker.com>
Upstream-commit: bc956c6b79dbe9cc7a1ab198f92b6843d072eb28
Component: engine
2014-09-16 09:34:21 -07:00
9a18f893c7 tarsum: version the addition of xattrs
Now that TarSum can be versioned, move the addition of xattr headers in
to the next version of TarSum

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 0ecafb8a6909f5d342246aefb9ac97350cef6558
Component: engine
2014-09-15 16:08:05 -04:00
52ac5025c9 tarsum: include xattr headers in to the checksum
this is to enhance the tarsum algorithm, but _MUST_ be done in lock step
with the same for docker-registry. (PR will be cited)

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
Upstream-commit: 448c8ecb0fb453bb29fcada5e7486355ccfadbe9
Component: engine
2014-09-15 15:05:01 -04:00
4dcbf56012 tarsum: TarSum is not the interface
don't export the exsisting TarSum struct and call the interface 'TarSum'
instead.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: ec01eb653db9d5e5b9291c1670dde57e7f742874
Component: engine
2014-09-10 21:56:20 -04:00
5f275ccb1b TarSum: versioning
This introduces Versions for TarSum checksums.
Fixes: https://github.com/docker/docker/issues/7526

It preserves current functionality and abstracts the interface for
future flexibility of hashing algorithms. As a POC, the VersionDev
Tarsum does not include the mtime in the checksum calculation, and would
solve https://github.com/docker/docker/issues/7387 though this is not a
settled Version is subject to change until a version number is assigned.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 747f89cd327db9d50251b17797c4d825162226d0
Component: engine
2014-09-10 15:41:52 -04:00
1c4a4c9a65 Merge pull request #7921 from unclejack/increase_tarsum_buffer_size
pkg/tarsum: make buffer size dynamic
Upstream-commit: 197f9b1e2b5810bbbd38b95b1d68c586033fad7c
Component: engine
2014-09-09 16:10:02 -04:00
855ab1fce7 tarsum: use Debugf, not Infof
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 6a8cae3e03d7253f2013b6c56eef64b18aea038f
Component: engine
2014-09-09 14:07:20 -04:00
5b1656c927 pkg/tarsum: add dynamic buffer sizing
This commit makes tarsum buffer allocation dynamic. This change
is required to avoid allocating memory excessively after the archive
buffering changes.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 7ef34407509fa76e3ead12a20c8b731f434e1971
Component: engine
2014-09-06 17:39:43 +03:00
fb6f6f58b2 Add Eric Windisch to MAINTAINER for tarsum
This code is vital to the security of the project and it is important
we assure it is well-maintained and guarded.

I am vested in assuring this code maintains security and
provides as much compatibility as possible between releases.

Signed-off-by: Eric Windisch <eric@windisch.us>
Upstream-commit: cd71f92a7fda7a8bdf328a91c37a759463862aeb
Component: engine
2014-08-20 11:19:46 -07:00
e56ddc1f46 pkg/tarsum: avoid buf2 allocation in Read
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 55533693be0f268d7d7a2d339369ce8617398542
Component: engine
2014-08-17 14:45:11 +03:00
4737f7cea5 Extract log utils into pkg/log
Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
Upstream-commit: a02f67be5b17da63d475e6f35956c1e72c3b2e7b
Component: engine
2014-08-13 15:18:15 -07:00
11a2f7d8c4 utils.Debugf -> fmt.Printf
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: ff02bea88302dcd21345f7e4258400b58b9c142b
Component: engine
2014-07-30 08:42:53 -07:00
3d1163e7b4 move testdata to tarsum package.
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 4184cccb0f291b329292da1a31108407cb1a4750
Component: engine
2014-07-30 06:52:24 -07:00
5a8e5fe7dc utils/tarsum* -> pkg/tarsum
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 1219e458d105461fd7de23fa4b04a1233f61f8a4
Component: engine
2014-07-30 06:42:12 -07:00