Correctly close pipe after error in tarsum verification

This addresses a subtle deadlock where an error during a copy prevented pipe
closure to propagate correctly. By closing down the read end of the pipe rather
than the write end, the waiting writer is properly signaled. A nice side-effect
of this change is that errors encountered by io.Copy are now propagated to the
verifier's Write method.

A test to ensure validation errors for unsupported digest types has been added,
as well.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day
2015-03-18 19:07:55 -07:00
parent 068d343ddf
commit 0306a41909
5 changed files with 91 additions and 5 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ if [ "$1" = '--go' ]; then
fi
# get digest package from distribution
clone git github.com/docker/distribution 0c130dff5baf3168f2c85630c6d2344b81261269
clone git github.com/docker/distribution d957768537c5af40e4f4cd96871f7b2bde9e2923
mv src/github.com/docker/distribution/digest tmp-digest
rm -rf src/github.com/docker/distribution
mkdir -p src/github.com/docker/distribution