[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: fix recent false failure due to a race
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH] tests: fix recent false failure due to a race |
Date: |
Thu, 21 Apr 2016 00:21:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 04/20/2016 06:12 PM, Pádraig Brady wrote:
> * tests/cp/parent-perm-race.sh: This new race introduced in
> commit v8.25-5-g632eda5 is quite hard to hit, but is due to
> `ls > fifo` doing write()/close()/exit() once `cp` has
> open() the source fifo. Then the subsequent comparison of the
> destination file may fail due to the file being missing or empty.
> Previously `ls` generated output that was independent of `cp`.
> Now we must wait for `cp` to finish before inspecting the
> destination file that it wrote.
> ---
> tests/cp/parent-perm-race.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/cp/parent-perm-race.sh b/tests/cp/parent-perm-race.sh
> index 0d0841c..8d09329 100755
> --- a/tests/cp/parent-perm-race.sh
> +++ b/tests/cp/parent-perm-race.sh
> @@ -43,6 +43,8 @@ do
> # $d/attr and has started to read the source file $attr/fifo.
> timeout 10 sh -c "ls -ld d/$attr >$attr/fifo" || fail=1
>
> + wait $pid || fail=1
> +
> ls_output=$(cat d/$attr/fifo) || fail=1
> case $attr,$ls_output in
> ownership,d???--[-S]--[-S]* | \
> @@ -52,8 +54,6 @@ do
> *)
> fail=1;;
> esac
> -
> - wait $pid || fail=1
> done
>
> Exit $fail
>
Nice one! ... and a good analysis:
+1
Thanks & have a nice day,
Berny