Subject: bug#9620: dd: bogus behavior when interrupted

From: Jim Meyering <[email-masked]>
Date: Sat, 15 Oct 2011 10:46:33 +0200

tags 9620 notabug
close 9620
thanks

Pádraig Brady wrote:
> On 09/27/2011 08:33 PM, Paul Eggert wrote:
>> This happened with coreutils 8.13 on Fedora 14 x86-64
>> (coreutils compiled with GCC 4.6.1).  I interrupted
>> 'dd' with control-C, but it didn't respond right away;
>> instead, it churned away and created the entire output file,
>> issuing a bogus diagnostic about the input file.  Here's
>> the transcript:
>>
>> $ dd if=/dev/zero of=$HOME/junk/zero bs=1024 count=1000000
>> ^C1000000+0 records in
>> 1000000+0 records out
>> 1024000000 bytes (1.0 GB) copied, 20.1583 s, 50.8 MB/s
>> dd: closing input file `/dev/zero': Bad file descriptor
>> $ ls -l zero
>> -rw-r--r-- 1 eggert eggert 1024000000 Sep 27 12:18 zero
>>
>> The problem with the diagnostic is intermittent.  It usually
>> does not happen.  Usually, there's simply an unconscionably long
>> wait between the time I type ^C and the time that dd exits, e.g.:
>>
>> $ dd if=/dev/zero of=zero bs=1024 count=1000000
>> ^C487034+0 records in
>> 487034+0 records out
>> 498722816 bytes (499 MB) copied, 11.6897 s, 42.7 MB/s
>>
>> (here I waited about 10 seconds between the time I typed
>> ^C and the time that dd exited).
>>
>> The filesystem is ext4 atop md (RAID-1).
>>
>> The same problem occurs with /bin/dd (coreutils 8.5) so
>> if it is a coreutils bug it's not a new one.
>>
>> Don't have time to debug this right now but thought I'd
>> get a bug report into the system.  Quite possibly it is not
>> a coreutils bug at all, but a kernel bug, but in that case
>> where do I report it? to a Fedora mailing list?
>
> I think this is a kernel signal propagation bug that I noticed on Fedora 14 too
> and I think Linda Walsh reported the same thing on the kernel list.
> I didn't notice it on later kernels so I didn't pursue it.
> Note I didn't notice errors, just delays.

Thanks for the report.

I confirm the same behavior with an ext4 partition and no md/lvm
using linux-2.6.40.6-0.fc15.x86_64.

However, with ext4 and linux-3.1.0-0.rc9.git0.0.fc17.x86_64 (rawhide)
in a VM the ^C takes effect immediately, so this is probably fixed
in the Fedora 16 kernels, too.

So I've marked this notabug and closed it.

> BTW that ^C being displayed (started around Fedora 11 time (2.6.30))
> is very annoying, especially when inserted in the middle of an ANSI code.
> I mentioned that previously here:
> http://mail.linux.ie/pipermail/ilug/2011-February/106723.html