On Fri, Jul 18, 2014 at 06:19:50PM +0300, Sergii Pylypenko wrote: > Package: apt-cacher > Version: 1.7.9.1 > Severity: normal > > Apt-cacher fails when downloading package libgphoto2-2_2.4.14-2_armhf.deb. > > Steps to reproduce: > > Install apt-cacher with default configuration. > > Run command: > > wget > http://localhost:3142/ftp.de.debian.org/debian/pool/main/libg/libgphoto2/libgphoto2-2_2.4.14-2_armhf.deb > > wget will report 'connection closed' near the end of the download, and retry > downloading in an infinite loop, with the same error. > > /var/log/apt-cacher/error.log contains this message for each failed download: > > Fri Jul 18 17:57:18 2014|info [13139]: ALARM! /var/cache/apt- > cacher/packages/libgphoto2-2_2.4.14-2_armhf.deb file size mismatch (found > 933504, expected 933508). Renaming to /var/cache/apt- > cacher/packages/libgphoto2-2_2.4.14-2_armhf.deb.corrupted.
Thanks for this. Sorry for being slow -- I have been away. Please could you try this patch which fixes it for me Mark commit 5c67363061b92b1bc1e0d9eefe7b848d04a48773 Author: Mark Hindley <[email protected]> Date: Fri Aug 15 14:09:48 2014 +0100 Protect an "\r\n\r\n" sequences from being chomp()ed by the reading process. diff --git a/apt-cacher b/apt-cacher index 3dd1eef..bd5edf9 100755 --- a/apt-cacher +++ b/apt-cacher @@ -1360,9 +1360,11 @@ sub body_callback { # Just add separators to the stream. The reading process will chomp # these. This prevents consuming amounts of memory by getting the whole # file in a single chunk. + my $length = length($chunk); + $chunk =~ s/\r\n\r\n/\r\r\n\r\n\n\r\r\n\r\n\n/g; # Protect any \r\n\r\n in the stream local $\ = "\r\n\r\n"; print $fh $chunk; - return length($chunk); + return $length; } sub debug_callback { -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

