bug-bash
[Top][All Lists]
Advanced

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

Re: race bug !?


From: Greg Wooledge
Subject: Re: race bug !?
Date: Fri, 29 Jan 2021 07:50:02 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Fri, Jan 29, 2021 at 12:33:17AM +0100, Jean-Jacques Brucker wrote:
> $ echo "dc30a6d79f3b47e310b8b9f5fbadba57" | tee >( xxd  -r -p | base64) |
> tee >(xxd  -r -p | basenc --base64url )
> dc30a6d79f3b47e310b8b9f5fbadba57
> 3DCm1587R+MQuLn1+626Vw==
> 3DCm1587R-MQuLn1-626Vz0Vhw==

Yes, there is a race condition bug, but it's in your script, not in bash.

You've launched two simultaneous background jobs (the process subs),
and they are both writing to the same place (your terminal).  You
should expect their output to be interleaved unpredictably.

If you want the two outputs to be separate, you need to write them to
different places, and then merge them afterward -- either that, or
run the two output-producing processes in series instead of in parallel.




reply via email to

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