Subject: bug#34519: [bug-diffutils] bug#34519: Test "colors" fails on Debian/ppc64el

From: Thiago Jung Bauermann <[email-masked]>
Date: Sat, 28 Aug 2021 12:29:17 -0300

Hello,

Em terça-feira, 27 de agosto de 2019, às 19:06:21 -03, Paul Eggert 
escreveu:
> Santiago Vila wrote:
> > In tests/colors there was a race condition which I tried to fix
> > by adding a "sleep 1", like this:
> > 
> > mkfifo fifo
> > printf '%1000000s-a' > a
> > printf '%1000000s-b' > b
> > head -c 10 < fifo > /dev/null &
> > sleep 1
> > diff --color=always ---presume-output-tty a b > fifo
> > test $? = 141 || fail=1
> 
> Sorry, but what is the race condition, and why would adding 'sleep 1'
> help? The test should work regardless of whether 'diff' starts before
> 'head' does.
> 
> Are fifos broken on your system somehow?
> 
> Can you use 'strace -f' to see what syscalls are going wrong in 'head'
> and/or 'diff'?

I still see this problem on powerpc64le-linux with version 3.8.

There was a great analysis of the problem made by Frédéric Bonnard (whom I 
took the liberty of copying on this message. I hope it’s ok), and also a 
tentative fix by him which would need to be assessed by someone more 
knowledgeable of the diffutils code:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922552#19

In short: it’s not a problem in the test. It’s a bug in the signal handling 
code that was added to support the ‘--color’ option.

For some reason, it’s particularly easy to hit on powerpc64le-linux. With 
Frédéric’s patch I can’t hit it anymore.

-- 
Thanks,
Thiago