On Fri, Jul 01, 2016 at 10:23:05AM -0700, Junio C Hamano wrote: > Jeff King <peff@xxxxxxxx> writes: > > > In shell scripts it is sometimes useful to be able to read > > exactly N bytes from a pipe. Doing this portably turns out > > to be surprisingly difficult. > > I'd rotate the above by three words ;-). > > It is sometimes useful to be able to read > exactly N bytes from a pipe. Doing this portably turns out > to be surprisingly difficult > in shell scripts. Yeah, I'd very much agree with that (feel free to mark it up as you apply). > > - "dd bs=1 count=$n" fixes the partial read problem (all > > reads are 1-byte, so there can be no partial response). > > It does make a lot of write() calls, but for our tests > > that's unlikely to matter. > > It makes me wonder if it helps to use different ibs and obs if many > writes bother you, but because this patch moves us away from dd, > that is a moot point. Actually, I just mis-spoke (mis-wrote?). I meant to say that it makes a lot of read() calls. (It probably also makes a lot of write() calls, but that is beside the point). -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