dd can exit prematurely upon SIGINFO/SIGUSR1
dd, if interrupted mid-write, exits prematurely. #4494 added the signal
handlers for INFO/USR1, which is useful, but much less useful if it causes dd
to exit :)
The following commands, followed by holding down ^T (SIGINFO) were sufficient
for me to repro, though dtrace is probably more reliable.
I got it to fail in two ways: first, when write returns EINTR.
% dd if=/dev/zero bs=8k |ssh $(hostname) 'cat >/dev/null'
write: Interrupted system call
3+0 records in
3+0 records out
16384 bytes transferred in 0.070784 secs (231465 bytes/sec)
and for the second case, when write returns less than expected:
% dd if=/dev/zero bs=100M | cat >/dev/null
1+0 records in
1+0 records out
104857600 bytes transferred in 0.269511 secs (389065446 bytes/sec)
dd: unexpected short write, wrote 95144960 bytes, expected 104857600
5+0 records in
5+0 records out
419430400 bytes transferred in 0.685301 secs (612037898 bytes/sec)
I'm not sure whether the same applies for read(), haven't looked at the code.