output: Improve xtrace output from subshells

Use buffering for the "preverrout" stream to ensure that the lines output by different commands in the same pipeline don't get mixed up when xtrace output is on.

While not being required by POSIX, this is a very welcome improvement making output from the different runs of the script identical, whereas before it almost always contained plenty of spurious differences due to the lines being broken up in different places.

Notice that the order of the different lines still remains undetermined, but this is consistent with the other shells and isn't a problem in practice.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567648


I'm trying to contribute this patch, made by Dash developer Harald van Dijk, as advised by him in this message on Dash mailing list. I'd prefer if the patch were applied to Dash itself, but this doesn't seem likely to happen and applying it to Debian would be the next best thing to do, and would fix the long-standing Debian bug referenced above.

Sorry if creating merge requests here is not the appropriate form of contributing patches, please let me know if you'd prefer me use BTS for it or do something else.

Thanks in advance!

Merge request reports

Loading