Subject: Re: Tapeboot problem SOLUTION
To: None <Ian.Dall@dsto.defence.gov.au>
From: Mark W. Eichin <eichin@kitten.gen.ma.us>
List: port-sun3
Date: 12/10/1995 23:17:03
>  gunzip < netbsd-rd.gz | dd bs=8k of=$T
>due to the pipe, dd will get short reads, which it copies quite

I don't think the pipe causes the short reads, but instead the fact
that gunzip uses stdio which uses BUFSIZ=1024 when it's not writing to
a tty.

The practical fix (since it applies to basically all unix systems) is
to use ibs and obs seperately; something like
  gunzip < netbsd-rd.gz | dd ibs=512 obs=8k of=$T conv=sync
works because
	1) gunzip uses stdio, which detects a non-tty and thus flushes
out of a BUFSIZ buffer which is 1024
	2) ibs of 512 will never get partial reads, as it takes two
reads to exactly consume a single write from gunzip
	3) since 8k is an integer multiple of 512, dd can do exact
writes (except at EOF)
	4) conv=sync covers the EOF case (and shouldn't have any other
effect.)

Possibly also 1a) 1024 is less than 4096, the maximum pipe buffer
size, so the pipe buffering has no effect on the result.

(This has gotten a bit afield from the sun3 port in particular, I'm afraid...)
			_Mark_ <eichin@kitten.gen.ma.us>
			The Herd of Kittens