Bug#745866: FileFd::Size failure on all big-endian architectures (patch attached)
Package: apt
Version: 1.0.2
Severity: serious
Tags: patch
Justification: fails to build from source (but built successfully in the past)
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu utopic ubuntu-patch
In Ubuntu, the attached patch was applied to achieve the following:
* apt-pkg/contrib/fileutl.cc: When checking gzip filesizes, cast
size to uint32_t before setting it, so we don't end up playing
with the wrong half of a uint64_t on big-endian architectures.
This patch should be fairly self-explanatory for people who grok
binary math and endian flips. Fixes the FTBFS on big-endian arches.
... Adam
-- System Information:
Debian Release: jessie/sid
APT prefers utopic-updates
APT policy: (500, 'utopic-updates'), (500, 'utopic-security'), (500, 'utopic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.13.0-24-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru apt-1.0.2ubuntu1/apt-pkg/contrib/fileutl.cc apt-1.0.2ubuntu2/apt-pkg/contrib/fileutl.cc
--- apt-1.0.2ubuntu1/apt-pkg/contrib/fileutl.cc 2014-04-25 05:49:56.000000000 -0600
+++ apt-1.0.2ubuntu2/apt-pkg/contrib/fileutl.cc 2014-04-25 19:34:00.000000000 -0600
@@ -1880,7 +1880,7 @@
FileFdErrno("lseek","Unable to seek to end of gzipped file");
return 0;
}
- size = 0;
+ uint32_t size = 0;
if (read(iFd, &size, 4) != 4)
{
FileFdErrno("read","Unable to read original size of gzipped file");
Reply to: