On Fri, Oct 27, 2023 at 2:42 AM Rob Landley <r...@landley.net> wrote: > > On 10/26/23 18:33, enh wrote: > > On Tue, Oct 24, 2023 at 12:31 AM Rob Landley <r...@landley.net> wrote: > >> Possibly the test is wrong, and I should change it to call "echo -n" and > >> check > >> for 'yyy'. How either way proves they ran in parallel is unclear... > > > > (yeah, if _other_ echo's aren't atomic, it probably doesn't make sense > > for you to bend over backwards to make yours atomic.) > > Well, other echo's _are_ atomic, "for the first 500 characters" or similar. > > $ strace /bin/echo one two three |& grep write > write(1, "one two three\n", 14one two three > > They stop being atomic when we exceed their stdio buffer size (which is > undocumented and variable)... > > $ strace /bin/echo $(seq 1 10000) |& grep write | wc -l > 12 > > and nothing's going to be atomic if it exceeds the kernel's pipe buffer size > (which is kernel version specific and changeable with ulimit... > > But not being atomic for a simple case like this smells likely to break other > stuff. Alas "smells" is not portably regression-testable.
true, but my usual argument of "...but at least you'll have the same behavior as the other implementations _on that specific system_" still holds. (but, yes, it's pretty clear that the toybox tests shouldn't be relying on what yes/echo may or may not actually do in practice...) > Rob _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net