bug-coreutils
[Top][All Lists]
Advanced

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

Re: dd: reblock failure -- sporadic failures


From: Pádraig Brady
Subject: Re: dd: reblock failure -- sporadic failures
Date: Sun, 30 Nov 2008 20:47:38 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Jim Meyering wrote:
> diff --git a/tests/dd/reblock b/tests/dd/reblock
> index 542529a..ef9e036 100755
> --- a/tests/dd/reblock
> +++ b/tests/dd/reblock
> @@ -44,7 +44,10 @@ sed 's/,.*//' err > k && mv k err
>  compare err exp-reblock || fail=1
> 
>  # Demonstrate that bs=N supersedes even following ibs= and obs= settings.
> -(echo x; sleep .1; echo y) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
> +# Choosing a delay of 0.1 would result in an occasional lost race where
> +# the consumer's first read would consume 3 bytes rather than the expected 2.
> +# Not wanting to sleep a full second, I'll raise that to 0.3.
> +(printf ab; sleep .3; printf cd) | dd bs=3 ibs=1 obs=1 > out 2> err || fail=1
>  sed 's/,.*//' err > k && mv k err
>  compare err exp-no-reblock || fail=1

Doesn't the same logic need to be applied to both tests in this file,
as they both expect 2 short reads?

Hmm, I wonder is there a way to get the producer
to wait until the consumer is ready.
I think both open()s on a fifo block on each other,
so the following would cause `printf ab` to happen
after dd has executed open(), which might help?

mkfifo dd.fifo
dd ibs=3 obs=3 if=dd.fifo > out 2> err&
(printf ab; sleep .1; printf cd) > dd.fifo
wait #for dd to complete
sed 's/,.*//' err > k && mv k err
compare err exp-no-reblock || fail=1

thanks,
Pádraig.





reply via email to

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