From: Junio C Hamano Date: Mon, 13 Dec 2010 07:21:37 GMT Subject: Re: [PATCH jn/fast-import-blob-access] t9300: avoid short reads from dd Message-ID: <7vfwu25e9q.fsf@alter.siamese.dyndns.org> In-Reply-To: <20101213063151.GB20812@burratino> Jonathan Nieder writes: > dd is a thin wrapper around read(2). As open group Issue 7 explains: > > It shall read the input one block at a time, using the specified > input block size; it shall then process the block of data > actually returned, which could be smaller than the requested > block size. > > Any short read --- for example from a pipe whose capacity cannot fill > a block --- results in that block being truncated. As a result, the > first cat-blob test (9300.114) fails on Mac OS X, where the pipe > capacity is around 8 KiB. I saw a similar breakage on my FBSD 8 bochs. It is unfortunate and feels yucky that we have to issue 8k+ read(2) of one byte, but I don't think of a better way. I thought it might be possible to specify cbs and/or conv to have the input buffered to a size to defeat the short read issue, but count specifies in terms of input blocks, so there doesn't seem to be a way to do so... Oh well... Thanks.