Re: [PATCH v4 1/5] t9300: factor out portable "head -c" replacement

2016-07-01 Thread Jeff King
On Fri, Jul 01, 2016 at 10:23:05AM -0700, Junio C Hamano wrote: > Jeff King 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

Re: [PATCH v4 1/5] t9300: factor out portable "head -c" replacement

2016-07-01 Thread Junio C Hamano
Jeff King 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

Re: [PATCH v4 1/5] t9300: factor out portable "head -c" replacement

2016-06-30 Thread Eric Sunshine
On Thursday, June 30, 2016, Jeff King wrote: > 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. > > We want a solution that: > > - is portable > > - never reads more than N

[PATCH v4 1/5] t9300: factor out portable "head -c" replacement

2016-06-30 Thread Jeff King
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. We want a solution that: - is portable - never reads more than N bytes due to buffering (which would mean those bytes are not available to