On Fri, Jun 24, 2016 at 03:41:47PM -0700, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > The difference in time between the two is measurable on my system, but > > it's only a few milliseconds (for 4096 bytes). So maybe it's not worth > > worrying about (though as a general technique, it does make me worry > > that it's easy to get wrong in a way that will fail racily). > > Yeah, GNU dd has iflag=fullblock, but if we assume GNU, we can > safely assume "head -c", so I do not think of a way to do this > portably enough. Thinking on it more, "head -c" is _not_ what one would want in all cases. It would work here, but not in t9300, for instance, where the code is trying to read an exact number of bytes from a fifo. I don't think "head" makes any promises about buffering and may read extra bytes. So I dunno. "dd" generally does make such promises, or perhaps the perl sysread() solution in t9300 is not so bad. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html