aboutsummaryrefslogtreecommitdiff
path: root/toys/other/i2ctools.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-04-26 15:13:24 -0700
committerRob Landley <rob@landley.net>2021-04-27 02:39:08 -0500
commit2c30d4f7a6a6ee16f9149519f6e2634b58c281cb (patch)
tree61004b68630e82d30ede55c9f34bc4f30ceea7e6 /toys/other/i2ctools.c
parent4785b7611de7eae714941b2e648ffa85c336108b (diff)
downloadtoybox-2c30d4f7a6a6ee16f9149519f6e2634b58c281cb.tar.gz
More line buffering.
This patch does two things: 1. Enable line buffering for echo and yes. I found this through test flakiness from the toybox xargs tests running in CI on devices where "echo" is provided by toybox. For `echo y`, GNU echo does one write of "y\n" but toybox echo was doing two writes, which makes it more likely (4% on the heavily-loaded CI machines) for writes from the two processes to be interleaved. 2. Fix line buffering on glibc if you're calling `toybox foo` rather than `foo`. Otherwise we come through once and switch to unbuffered mode, then again and switch to line buffered mode --- which doesn't seem to actually work in glibc unless you specify a buffer (so passing toybuf and sizeof(toybuf) works, but NULL and 0 doesn't). I hit the second issue trying to reproduce the first issue on the desktop rather than on Android. (If you're scratching your head wondering "why yes(1) too, not just echo(1)?", that represents a blind alley I went down when I mistook which tool was in use. It seemed like the same principle should apply, and it matches what other implementations do.)
Diffstat (limited to 'toys/other/i2ctools.c')
0 files changed, 0 insertions, 0 deletions