--- Begin Message ---
Source: apt
Version: 1.1.5
Severity: important
Tags: patch
Hi,
I identified a couple of regressions in CopyFile:
- the first makes the copy a lot slower than it used to be (copying by
chunks of 8 bytes)
- the second one breaks CopyFile on the Hurd
Longer explanations of each issue are part of the commit messages of
the patches.
Thanks,
--
Pino
>From 457ed97bafa438abbb9ba8fefeb755e6fe450791 Mon Sep 17 00:00:00 2001
From: Pino Toscano <pino@debian.org>
Date: Sat, 19 Dec 2015 12:00:43 +0100
Subject: [PATCH] CopyFile: fix BufSize to a sane value
Commit e977b8b9234ac5db32f2f0ad7e183139b988340d tries to make BufSize
calculated based on the size of the buffer; the problem is that
std::unique_ptr::size() returns a pointer to the data, so sizeof()
equals to the size of a pointer (later divided by sizeof(char), which
is 1). The result is that the CopyFile copies in chunks of 8 bytes,
which is not exactly ideal...
As solution, declare BufSize in advance, and use its value to allocate
the Buf array.
---
apt-pkg/contrib/fileutl.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 014f0ee..86ca82c 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -160,8 +160,8 @@ bool CopyFile(FileFd &From,FileFd &To)
return false;
// Buffered copy between fds
- std::unique_ptr<unsigned char[]> Buf(new unsigned char[64000]);
- constexpr unsigned long long BufSize = sizeof(Buf.get())/sizeof(Buf.get()[0]);
+ constexpr size_t BufSize = 64000;
+ std::unique_ptr<unsigned char[]> Buf(new unsigned char[BufSize]);
unsigned long long ToRead = 0;
do {
if (From.Read(Buf.get(),BufSize, &ToRead) == false ||
--
2.6.4
>From 09c2114ecacec6d9f91a62fabcb34c05f77ca712 Mon Sep 17 00:00:00 2001
From: Pino Toscano <pino@debian.org>
Date: Sat, 19 Dec 2015 12:06:53 +0100
Subject: [PATCH] CopyFile: avoid failing on EOF on some systems
On EOF, ToRead will be 0, which might trigger on some systems (e.g.
on the Hurd) an error due to the invalid byte count passed to write().
The whole loop already checks for ToRead != 0, so perform the writing
step only when there was actual data read.
---
apt-pkg/contrib/fileutl.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 86ca82c..1ffa407 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -165,7 +165,7 @@ bool CopyFile(FileFd &From,FileFd &To)
unsigned long long ToRead = 0;
do {
if (From.Read(Buf.get(),BufSize, &ToRead) == false ||
- To.Write(Buf.get(),ToRead) == false)
+ (ToRead > 0 && To.Write(Buf.get(),ToRead) == false))
return false;
} while (ToRead != 0);
--
2.6.4
--- End Message ---
--- Begin Message ---
Source: apt
Source-Version: 1.1.6
We believe that the bug you reported is fixed in the latest version of
apt, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 808381@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Julian Andres Klode <jak@debian.org> (supplier of updated apt package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Thu, 24 Dec 2015 17:01:49 +0100
Source: apt
Binary: apt libapt-pkg5.0 libapt-inst2.0 apt-doc libapt-pkg-dev libapt-pkg-doc apt-utils apt-transport-https
Architecture: source
Version: 1.1.6
Distribution: unstable
Urgency: medium
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Julian Andres Klode <jak@debian.org>
Description:
apt - commandline package manager
apt-doc - documentation for APT
apt-transport-https - https download transport for APT
apt-utils - package management related utility programs
libapt-inst2.0 - deb package format runtime library
libapt-pkg-dev - development files for APT's libapt-pkg and libapt-inst
libapt-pkg-doc - documentation for APT development
libapt-pkg5.0 - package management runtime library
Closes: 808381 808383 808561 808579
Changes:
apt (1.1.6) unstable; urgency=medium
.
Merry Christmas from the APT Team
.
[ Pino Toscano ]
* Fix FileUtlTest.GetTempDir failure when run as root (Closes: #808383)
* CopyFile: fix BufSize to a sane value (Closes: #808381)
* CopyFile: avoid failing on EOF on some systems (Closes: #808381)
.
[ Julian Andres Klode ]
* Do nothing in FileFd::Write() if Size is 0 (Closes: #808381)
.
[ David Kalnischkies ]
* avoid evaluating shell in paths used in apt-key
* avoid triggering gpg2 migration in apt-key
* follow dpkg and xz and use CRC64 for xz compression
* parse xz-compression level from configuration
* implement a buffer system for FileFd::ReadLine (Closes: 808579)
* ensure we got a lock in clean operation (Closes: 808561)
Checksums-Sha1:
40e5ec78a052d829cfb62e434723425cb3e44ba3 2297 apt_1.1.6.dsc
33c4a78823ba38d3f947870e11cf609a4908cd14 1992680 apt_1.1.6.tar.xz
Checksums-Sha256:
391e1606e768b3a60bc837bcbd730f1f76373d340501556629f31343512073d9 2297 apt_1.1.6.dsc
3e0c999fe74cfaebd1d24efc9e39dd56a697b80afacb4a556431b9385d411221 1992680 apt_1.1.6.tar.xz
Files:
de5e8c3008a90dd904018c51ef5cc436 2297 admin important apt_1.1.6.dsc
f71ca903958b4cf3962b670aa4a73bc6 1992680 admin important apt_1.1.6.tar.xz
-----BEGIN PGP SIGNATURE-----
iQIcBAEBCgAGBQJWfBoDAAoJENc8OeVlgLOG6A8P/1mQs+oLrrhYUlzyiPppSNgb
pNwfsb1ZNFj1SZUlKlXGRQcs8aYvsN1WIYD1mYS9gp5Hwi3rNtidy03nRH3phsFD
f8IOCfAV3UCzg84L0Gi2w6WtWrz2uCH/Qj6jlEjeiV3N6r9XQUdYMMJIzQo0sv4L
O8Dr7hLoPd8JcShWGrTl50e5n6H/xA08a1MuGkcYHqIhAnZbSIlclAEB7Dg8+y7P
5Ze57Gm6BhSryI+5s1yLcgTvl+0fFMoF1xCmEzd8LtxOOqms8WBYnnUF7nagl5Fy
aZve8hiuEqQEXGpTepFTeyfv4wenzrKCQ7VUVnzAyCSKZ9RW1jJwUrdOZ+DMvvnE
sBPcAvPZVvIHLgs7FTEqsESZkr/RtbojjdfCW1BitiksP2KaUJq/LbBsMOSUGTDr
ZktGMJJkvKAZ0Ao5SPjLlKdtWBKui/v7zKHi2XzmTvyoKbQOc9jvA25EOgHsTNH1
zVt+03JdC4txVZOJYEtlFJCVr7lb14d9rHFom+y7XeKsSo2x5i6MsGktsS9Wpiat
XOq0c3ULGfFynDqf9k3qrIfQZzk6ldMDBhvUxYg10GQ0YERCdVcbIDR9BxUOwt5B
rR2QhO/RCrWT4YOY8czqcpMm5nW9w0ClNAriE2v+6q8k+DGkDzpFxtVrTYdU4IzA
iky55QBk4cm5HcvEH/oU
=sN4b
-----END PGP SIGNATURE-----
--- End Message ---