Pádraig Brady writes:
>   find /disk1 | xargs md5sum & find /disk2 | xargs md5sum
> 
> Note if we're piping/redirecting the output of the above
> then we must be careful to line buffer the output from md5sum
> so that it's not interspersed.

That doesn't sound right, nor sufficient.

If you pipe the output, you shouldn't have a problem in any case,
as long as output is done in chunks less than PIPE_BUF.
If you redirect the output, you need to use append mode: >> file
rather than > file.  Otherwise, you still have a race, it's just
less likely to be won.

Of course, line buffering by default still seems like a good idea.

Cheers,
Ralf



Reply via email to