The following commit has been merged in the lenny branch: commit 7c75872f5cf43b98fc7facbe057c3f98d50a4172 Author: Raphael Hertzog <hert...@debian.org> Date: Thu Apr 9 18:35:10 2009 +0200
dpkg-source: don't die on SIGPIPE of uncompressors Modify Dpkg::Source::CompressedFile to not die when uncompressors processes (gunzip, bunzip, etc.) are killed by SIGPIPE. Recent tar versions close the pipe before having read everything sent by the uncompressor process when they encounter the end of the tar file. This was of course problematic for Dpkg::Source::Archive. This is a regression compared to etch's dpkg-source which dealt with SIGPIPE properly. The Dpkg::Source::Compressor::wait_end_process() function had to be extended to be able to forward options to Dpkg::IPC::wait_child(). diff --git a/ChangeLog b/ChangeLog index bf839a7..db7ebb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-04-09 Raphael Hertzog <hert...@debian.org> + + * scripts/Dpkg/Source/CompressedFile.pm (cleanup_after_open): Do + not die when uncompressors processes (gunzip, bunzip, etc.) are + killed by SIGPIPE. + * scripts/Dpkg/Source/Compressor.pm (wait_end_process): Modified + so that it can forward options to Dpkg::IPC::wait_child(). + 2009-02-03 Guillem Jover <guil...@debian.org> * configure.ac: Bump version to 1.14.26~. diff --git a/debian/changelog b/debian/changelog index 79223b5..f813d13 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,10 @@ dpkg (1.14.26) UNRELEASED; urgency=low + [ Raphael Hertzog ] + * Fix dpkg-source to not die when uncompressor processes are killed by + SIGPIPE due to tar closing the pipe without exhausting all the data + available. Closes: #523329 + [ Updated scripts translations ] * German (Helge Kreutzmann). * Polish (Wiktor Wandachowicz). Closes: #514106 diff --git a/scripts/Dpkg/Source/CompressedFile.pm b/scripts/Dpkg/Source/CompressedFile.pm index 94fdce9..8367b93 100644 --- a/scripts/Dpkg/Source/CompressedFile.pm +++ b/scripts/Dpkg/Source/CompressedFile.pm @@ -22,7 +22,8 @@ use warnings; use Dpkg::Compression; use Dpkg::Source::Compressor; use Dpkg::Gettext; -use Dpkg::ErrorHandling qw(error syserr warning); +use Dpkg::ErrorHandling qw(error syserr warning subprocerr); +use POSIX; # Object methods sub new { @@ -35,6 +36,7 @@ sub new { $self->{"compressor"} = Dpkg::Source::Compressor->new(); $self->{"add_comp_ext"} = $args{"add_compression_extension"} || $args{"add_comp_ext"} || 0; + $self->{"allow_sigpipe"} = 0; if (exists $args{"filename"}) { $self->set_filename($args{"filename"}); } @@ -126,6 +128,7 @@ sub open_for_read { if ($self->use_compression()) { $self->{'compressor'}->uncompress(to_pipe => \$handle, from_file => $self->get_filename()); + $self->{'allow_sigpipe'} = 1; } else { open($handle, '<', $self->get_filename()) || syserr(_g("cannot read %s"), $self->get_filename()); @@ -135,7 +138,12 @@ sub open_for_read { sub cleanup_after_open { my ($self) = @_; - $self->{"compressor"}->wait_end_process(); + $self->{"compressor"}->wait_end_process(nocheck => $self->{'allow_sigpipe'}); + if ($self->{'allow_sigpipe'}) { + unless (($? == 0) || (WIFSIGNALED($?) && (WTERMSIG($?) == SIGPIPE))) { + subprocerr($self->{"compressor"}{"cmdline"}); + } + } } 1; diff --git a/scripts/Dpkg/Source/Compressor.pm b/scripts/Dpkg/Source/Compressor.pm index 1843a2f..6797a49 100644 --- a/scripts/Dpkg/Source/Compressor.pm +++ b/scripts/Dpkg/Source/Compressor.pm @@ -122,8 +122,9 @@ sub uncompress { } sub wait_end_process { - my ($self) = @_; - wait_child($self->{"pid"}, cmdline => $self->{"cmdline"}) if $self->{'pid'}; + my ($self, %opts) = @_; + $opts{"cmdline"} ||= $self->{"cmdline"}; + wait_child($self->{"pid"}, %opts) if $self->{'pid'}; delete $self->{"pid"}; delete $self->{"cmdline"}; } -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org