recently (2008-11-25), this change was committed: 2008-11-25 Sergey Poznyakoff <[email protected]> Do not try to drain the input pipe before closing the archive.
* src/buffer.c (close_archive): Remove call to
sys_drain_input_pipe. Pass hit_eof as the second
argument to sys_wait_for_child.
* src/common.h (sys_drain_input_pipe): Remove
(sys_wait_for_child): Declare second argument.
* src/system.c (sys_drain_input_pipe): Remove.
(sys_wait_for_child): Take two arguments. The second one helps to
decide whether to tolerate child termination on SIGPIPE.
unfortunately, this causes problems with simple operations. for example,
download this tarball:
ftp://ftp.gnome.org/pub/gnome/sources/glibmm/2.18/glibmm-2.18.1.tar.bz2
and then attempt to unpack it by doing:
$ bzip2 -dc glibmm-2.18.1.tar.bz2 | tar xof -
you wont get any error from tar and everything will be extracted correctly,
but bzip2 itself will die with SIGPIPE as can be seen in both strace:
write(1, "glibmm-2.18.1/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = -1
EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
+++ killed by SIGPIPE +++
and by bash itself:
$ echo ${pipestat...@]}
141 0
you may say "well just check the exit status of tar and go with that", but
that doesnt work for cases where the decompressor crashes/exits/whatever early
on and tar gets a short archive. you may also say "well change how you evoke
tar", but that isnt trivial to do as we support a wide range of tar versions
(not just GNU, and not any GNU specific version).
-mike
signature.asc
Description: This is a digitally signed message part.
