From e18be2d51775fe3c3de143707ad3e3eeeedbccc3 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 18 Feb 2014 12:43:38 +0100 Subject: [PATCH] Bug #2729: Race condition in hash calculation in downloader.sh --- src/datastore_mad/remotes/downloader.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/datastore_mad/remotes/downloader.sh b/src/datastore_mad/remotes/downloader.sh index b387bd2d98..d5be9ae5c9 100755 --- a/src/datastore_mad/remotes/downloader.sh +++ b/src/datastore_mad/remotes/downloader.sh @@ -188,8 +188,10 @@ esac file_type=$(get_type "$command") decompressor=$(get_decompressor "$file_type") +# Note: the 'cat' at the end of this pipeline forces the pipe to wait until +# all the 'tee' processes are finished $command | tee >( decompress "$decompressor" "$TO" ) \ - >( hasher $HASH_TYPE ) >/dev/null + >( hasher $HASH_TYPE ) | cat >/dev/null if [ "$?" != "0" ]; then echo "Error copying" >&2