Fix tar-in command hangs when running out of disk space (RHBZ#580246).
authorRichard Jones <rjones@redhat.com>
Thu, 8 Apr 2010 07:48:38 +0000 (08:48 +0100)
committerRichard Jones <rjones@redhat.com>
Thu, 8 Apr 2010 21:22:48 +0000 (22:22 +0100)
commitdfd7f552bbd09d3e0fb9bcd99a195e04ae9d6de8
treeeec7977d450f7c0156a8615dc3d95252296e0ea4
parent3f785126cfa9cd4a100ca43cb1580e33c2860845
Fix tar-in command hangs when running out of disk space (RHBZ#580246).

The problem was this sequence of events:

 (1) File transfer goes through OK.

 (2) pclose returns failure (because 'tar' subprocess failed)

 (3) We try to cancel the transfer by calling cancel_receive.

Step (3) fails because the transfer (as far as the library is
concerned) has succeeded, so causing a hang.

The more fundamental reason why we see steps (1) and (2) is that
'tar' does NOT fail immediately if there is a write error.  Instead
it continues reading and discarding the input until the end of the
input before giving "Error exit delayed from previous errors".
IMHO this is a bug with tar, since an ENOSPC write error should
be fatal for tar.
(cherry picked from commit 07f4b20ae959069fca41756b0dc103ec5fa99754)
daemon/tar.c
daemon/upload.c