coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: fix races wrt output files of background processes


From: Bernhard Voelker
Subject: Re: [PATCH] tests: fix races wrt output files of background processes
Date: Sun, 10 Jan 2016 13:56:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 01/10/2016 01:28 PM, Pádraig Brady wrote:
> On 10/01/16 00:56, Bernhard Voelker wrote:
>> At least the false positive in tail-2/follow-stdin.sh could be seen
>> on a 4-core i5 system with -j8.  Fix similar cases. too.
>>
>> * tests/tail-2/follow-stdin.sh: Empty the 'out' file in each iteration.
>> Otherwise, under heavy system load, 'check_tail_output' would see the
>> expected output from the previous round before tail would have the
>> chance to come up in the background.
> 
> Nice. Yes the fork (clone) happens before the open (O_TRUNC):
>   strace -f sh -c '/bin/true > out & pid=$!'
> 
>> * tests/dd/stats.sh: Likewise
>> * tests/misc/cat-buf.sh: Likewise.
>> * tests/misc/stdbuf.sh: Likewise.
> 
> No race for these 3 due to explicit `wait`,
> but better to make the change for consistency.
> 
>> * tests/tail-2/wait.sh
> 
> Yes this was racy too.

I also checked other places found by
   git grep -C20 '>.* & pid=' -- tests
but most of them don't use a loop or otherwise don't use the same output
file in consecutive test statements.  So I hope we got them all now.

> +1 to complete patch.

Thanks for the review - pushed.

Have a nice day,
Berny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]