Project

General

Profile

Bug #6028

dd can exit prematurely upon SIGINFO/SIGUSR1

Added by Lauri Tirkkonen over 5 years ago. Updated over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2015-06-23
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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.

#1

Updated by Lauri Tirkkonen over 5 years ago

Lauri Tirkkonen wrote:

% dd if=/dev/zero bs=8k |ssh $(hostname) cat >/dev/null

'cat >/dev/null' should be quoted here, of course. (Editing the bug description seems broken - it shows me an empty form).

#2

Updated by Yuri Pankov over 5 years ago

  • Description updated (diff)

Also available in: Atom PDF