On Mon, Jun 26, 2023 at 7:09 PM steve jenkin <sjenkin@canb.auug.org.au> wrote:


I’ve never figured out how to use ‘dd’ so it returns after a single block is written
doesn’t close the input, killing the pipeline, or cause the rest of the data
to be discarded.

The trick here is understanding how ibs & obs, EOF is handled and probably osync, then how to use iseek (iskip in modern versions).
It's not that hard. Its been done many times. 

One of the more interesting issues with dd is most versions still are single threaded which sucks for most media - particularly f you want to stream things.
There was a wonderful hack to dd done in the. early 1980s by Tapani Lindgren ddd - double dd - which used two processes and a pipe to control them, so one process was always reading while the other was writing.   You can one it Volume 14, issue 85 in the comp.sources.unix archives.

Years ago, I hacked up a version using threads to do the same thing with a mutex to protect everything (It ever ran on Windows at some point).