On Thu, Jan 21, 2021 at 2:07 PM Mathias Steiger <mathias.stei...@googlemail.com> wrote: > > > As such bugs are likely related to buffer issues, maybe even in > underlying APIs, and since they only surface after very lengthy > mysterious sequences of commands - often just on single specific system > installations - I wouldn't know how you can reproduce this in a test. > > Maybe you have specific testing frameworks for this, that would reduce > the whole script to more basic components and which schematically remove > or add complexity until the nature of the bug becomes more apparent? > > This seems to call for a specialist who is able to follow the problem > into a far lower level of abstraction. > > As it stands now, I don't see how there is no way how this kind of > execution can make any sense from a scripting POV. > > Of course in a giant script, all sorts of random things might happen. > But this is not one of them.
You could run the script through "strace" or a similar command to see what's writing that output and when. We could use that log output to confirm that it is indeed Bash that is writing this out-of-order and to a file descriptor that it shouldn't. Greg pointed out earlier that the construct you're trying to use doesn't work well when the shell is not Bash. Are you 100% confident that it is /bin/bash that is running the script and not /bin/sh (and thus maybe something like Dash?). And keep in mind that even Bash running as /bin/sh is not quite the same as Bash running as /bin/bash.