From ef86a8a4204ad579f1ab80f728a22b2ad0d34266 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 9 Feb 2011 22:57:51 +0100 Subject: * cmdline/apt-get.cc: - add --install-suggests option (Closes: #473089) --- cmdline/apt-get.cc | 1 + debian/changelog | 8 ++++++++ doc/apt-get.8.xml | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 878313212..1211a3411 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -3195,6 +3195,7 @@ int main(int argc,const char *argv[]) /*{{{*/ {0,"auto-remove","APT::Get::AutomaticRemove",0}, {0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0}, {0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean}, + {0,"install-suggests","APT::Install-Suggests",CommandLine::Boolean}, {0,"fix-policy","APT::Get::Fix-Policy-Broken",0}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, diff --git a/debian/changelog b/debian/changelog index deb4d3161..bb2e9d63c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.8.12) unstable; urgency=low + + [ David Kalnischkies ] + * cmdline/apt-get.cc: + - add --install-suggests option (Closes: #473089) + + -- David Kalnischkies Wed, 09 Feb 2011 22:56:27 +0100 + apt (0.8.11.1) unstable; urgency=low [ Stefan Lippers-Hollmann ] diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml index 1688c9136..18f26e569 100644 --- a/doc/apt-get.8.xml +++ b/doc/apt-get.8.xml @@ -337,6 +337,11 @@ Configuration Item: APT::Install-Recommends. + + Consider suggested packages as a dependency for installing. + Configuration Item: APT::Install-Suggests. + + Download only; package files are only retrieved, not unpacked or installed. Configuration Item: APT::Get::Download-Only. -- cgit v1.2.3 From ec7f904e7ea1b0b8aaefbbb202ced9e19292dd76 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 10 Feb 2011 18:10:14 +0100 Subject: use apt-mark instead of hand-mangling with the extended_states file --- test/integration/framework | 14 +++++++ test/integration/test-apt-get-autoremove | 8 +--- .../integration/test-bug-604222-new-and-autoremove | 6 +-- test/integration/test-bug-611729-mark-as-manual | 47 ++++++---------------- test/integration/test-disappearing-packages | 4 +- 5 files changed, 34 insertions(+), 45 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index e10709079..11d9a9659 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -79,6 +79,7 @@ aptcache() { runapt apt-cache $*; } aptget() { runapt apt-get $*; } aptftparchive() { runapt apt-ftparchive $*; } aptkey() { runapt apt-key $*; } +aptmark() { runapt apt-mark $*; } dpkg() { $(which dpkg) --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log $* } @@ -647,3 +648,16 @@ testdpkgnotinstalled() { fi msgpass } + +testmarkedauto() { + local COMPAREFILE=$(mktemp) + addtrap "rm $COMPAREFILE;" + if [ -n "$1" ]; then + msgtest 'Test for correctly marked as auto-installed' "$*" + while [ -n "$1" ]; do echo "$1"; shift; done | sort > $COMPAREFILE + else + msgtest 'Test for correctly marked as auto-installed' 'no package' + echo > $COMPAREFILE + fi + aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail +} diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index 9dfab19f5..c25ce3f58 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -14,10 +14,7 @@ setupaptarchive aptget install unrelated debhelper -qq 2>&1 > /dev/null testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'po-debconf' aptget remove debhelper -y -qq 2>&1 > /dev/null testdpkgnotinstalled 'debhelper' testdpkginstalled 'po-debconf' 'unrelated' @@ -43,8 +40,7 @@ testdpkginstalled "po-debconf" rm rootdir/etc/apt/apt.conf.d/00autoremove aptget autoremove -y -qq 2>&1 > /dev/null testdpkgnotinstalled 'po-debconf' - -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' testfileequal 'rootdir/var/log/apt/history.log' ' diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index fa6dcdc70..9187dd1cd 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -7,9 +7,9 @@ setupenvironment configarchitecture "i386" setupaptarchive -echo 'Package: libvtk5.4 -Auto-Installed: 1 -Architecture: i386' > rootdir/var/lib/apt/extended_states +touch rootdir/var/lib/apt/extended_states +aptmark markauto 'libvtk5.4' +testmarkedauto 'libvtk5.4' testequal "Reading package lists... Building dependency tree... diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index 9c1cd3d1b..4e3e2fa0b 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -17,59 +17,41 @@ setupaptarchive # dpkg freaks out if the last package is removed so keep one around aptget install peace-dpkg -y -qq 2>&1 > /dev/null testdpkginstalled peace-dpkg -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto aptget install a -y -qq 2>&1 > /dev/null testdpkginstalled a b testdpkgnotinstalled c -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' aptget remove a -y -qq 2>&1 > /dev/null testdpkgnotinstalled a c testdpkginstalled b -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' aptget install c -y -qq 2>&1 > /dev/null testdpkgnotinstalled a testdpkginstalled b c -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' testequal 'Reading package lists... Building dependency tree... Reading state information... b is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' testequal 'Reading package lists... Building dependency tree... Reading state information... b is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -d -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' aptget install b --reinstall -y -qq 2>&1 > /dev/null testdpkgnotinstalled a testdpkginstalled b c -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 1 -' +testmarkedauto 'b' testequal 'Reading package lists... Building dependency tree... @@ -77,29 +59,26 @@ Reading state information... b is already the newest version. b set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b -testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: b -Architecture: i386 -Auto-Installed: 0 -' +testmarkedauto aptget remove b -y -qq 2>&1 > /dev/null testdpkgnotinstalled a b c -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto aptget install a b -y -qq 2>&1 > /dev/null testdpkginstalled a b testdpkgnotinstalled c -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto aptget purge a b -y -qq 2>&1 > /dev/null testdpkgnotinstalled a b c -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto aptget install b c -y -qq 2>&1 > /dev/null testdpkgnotinstalled a testdpkginstalled b c -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto aptget install a -y -qq 2>&1 > /dev/null testdpkginstalled a b c -testfileequal 'rootdir/var/lib/apt/extended_states' '' +testmarkedauto diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index 12d215d7a..b5d565c2f 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -31,7 +31,7 @@ setupaptarchive aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null -testfileequal "rootdir/var/lib/apt/extended_states" "" # old-pkg is manual installed +testmarkedauto # old-pkg is manual installed local CMD="aptget dist-upgrade -y -q=0" msgtest "Test for equality of" "$CMD" @@ -51,4 +51,4 @@ Install: new-pkg:i386 (2.0, automatic) Upgrade: old-pkg:i386 (1.0, 2.0) Disappeared: old-pkg (1.0)" -testfileequal "rootdir/var/lib/apt/extended_states" "" # new-pkg should have get the manual flag from old-pkg +testmarkedauto # new-pkg should have get the manual flag from old-pkg -- cgit v1.2.3 From fdbe726599ae4dd3d808858356cf3464de94f1e4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 11 Feb 2011 17:47:50 +0100 Subject: * apt-pkg/depcache.cc: - mark a package which was requested to be installed on commandline always as manual regardless if it is already marked or not as the marker could be lost later by the removal of rdepends (Closes: #612557) --- apt-pkg/depcache.cc | 5 +- debian/changelog | 6 ++- test/integration/status-bug-612557-garbage-upgrade | 34 ++++++++++++ test/integration/test-bug-612557-garbage-upgrade | 60 ++++++++++++++++++++++ 4 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 test/integration/status-bug-612557-garbage-upgrade create mode 100755 test/integration/test-bug-612557-garbage-upgrade diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 7c09d3a38..0c5b77732 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1257,9 +1257,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if(FromUser) { - // Set it to manual if it's a new install or cancelling the - // removal of a garbage package. - if(P.Status == 2 || (!Pkg.CurrentVer().end() && !P.Marked)) + // Set it to manual if it's a new install or already installed + if(P.Status == 2 || Pkg->CurrentVer != 0) P.Flags &= ~Flag::Auto; } else diff --git a/debian/changelog b/debian/changelog index bb2e9d63c..2da3afa38 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,12 @@ apt (0.8.12) unstable; urgency=low [ David Kalnischkies ] * cmdline/apt-get.cc: - add --install-suggests option (Closes: #473089) + * apt-pkg/depcache.cc: + - mark a package which was requested to be installed on commandline + always as manual regardless if it is already marked or not as the + marker could be lost later by the removal of rdepends (Closes: #612557) - -- David Kalnischkies Wed, 09 Feb 2011 22:56:27 +0100 + -- David Kalnischkies Fri, 11 Feb 2011 17:44:49 +0100 apt (0.8.11.1) unstable; urgency=low diff --git a/test/integration/status-bug-612557-garbage-upgrade b/test/integration/status-bug-612557-garbage-upgrade new file mode 100644 index 000000000..7403d8cca --- /dev/null +++ b/test/integration/status-bug-612557-garbage-upgrade @@ -0,0 +1,34 @@ +Package: python-uno +Status: install ok installed +Priority: optional +Section: python +Installed-Size: 2032 +Maintainer: Debian OpenOffice Team +Architecture: i386 +Source: openoffice.org +Version: 1:3.2.1-11+squeeze2 +Description: Python-UNO bridge + +Package: openoffice.org-common +Status: install ok installed +Priority: optional +Section: editors +Installed-Size: 48356 +Maintainer: Debian OpenOffice Team +Architecture: all +Source: openoffice.org +Version: 1:3.2.1-11+squeeze2 +Description: office productivity suite -- arch-independent files + +Package: openoffice.org-emailmerge +Status: install ok installed +Priority: optional +Section: editors +Installed-Size: 1652 +Maintainer: Debian OpenOffice Team +Architecture: all +Source: openoffice.org +Version: 1:3.2.1-11+squeeze2 +Replaces: python-uno (<< 1:2.4.1-5) +Pre-Depends: python-uno, openoffice.org-common +Description: office productivity suite -- email mail merge diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade new file mode 100755 index 000000000..e2ffe615f --- /dev/null +++ b/test/integration/test-bug-612557-garbage-upgrade @@ -0,0 +1,60 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertpackage 'unstable' 'unrelated' 'all' '1:3.3.0-2' +insertpackage 'unstable' 'python-uno' 'all' '1:3.3.0-2' 'Depends: libreoffice-common' +insertpackage 'unstable' 'libreoffice-common' 'all' '1:3.3.0-2' 'Conflicts: openoffice.org-common' + +setupaptarchive + +touch rootdir/var/lib/apt/extended_states +aptmark markauto python-uno ure uno-libs3 openoffice.org-common openoffice.org-style-galaxy +#aptmark unmarkauto openoffice.org-emailmerge +testmarkedauto python-uno ure uno-libs3 openoffice.org-common openoffice.org-style-galaxy + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libreoffice-common +The following packages will be REMOVED: + openoffice.org-common openoffice.org-emailmerge +The following NEW packages will be installed: + libreoffice-common +The following packages will be upgraded: + python-uno +1 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +After this operation, 53.2 MB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno + +aptmark markauto openoffice.org-emailmerge +testmarkedauto python-uno ure uno-libs3 openoffice.org-common openoffice.org-style-galaxy openoffice.org-emailmerge + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following extra packages will be installed: + libreoffice-common +The following packages will be REMOVED: + openoffice.org-common openoffice.org-emailmerge +The following NEW packages will be installed: + libreoffice-common +The following packages will be upgraded: + python-uno +1 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +After this operation, 53.2 MB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + openoffice.org-common openoffice.org-emailmerge python-uno +0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. +After this operation, 53.3 MB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation.' aptget autoremove --trivial-only -- cgit v1.2.3 From 37254316e0b1c3b0c067cf1962d0882d70a38c12 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 12 Feb 2011 13:43:32 +0100 Subject: * methods/rred.cc: - read patch into MMap only if we work on uncompressed patches --- debian/changelog | 4 +++- methods/rred.cc | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2da3afa38..4f1a8afa4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,10 @@ apt (0.8.12) unstable; urgency=low - mark a package which was requested to be installed on commandline always as manual regardless if it is already marked or not as the marker could be lost later by the removal of rdepends (Closes: #612557) + * methods/rred.cc: + - read patch into MMap only if we work on uncompressed patches - -- David Kalnischkies Fri, 11 Feb 2011 17:44:49 +0100 + -- David Kalnischkies Sat, 12 Feb 2011 13:43:11 +0100 apt (0.8.11.1) unstable; urgency=low diff --git a/methods/rred.cc b/methods/rred.cc index 1a18a381c..80cd14986 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -252,13 +252,15 @@ struct EdCommand { /*{{{*/ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/ FileFd &out_file, Hashes *hash) const { #ifdef _POSIX_MAPPED_FILES - MMap ed_cmds(Patch, MMap::ReadOnly); + MMap ed_cmds(MMap::ReadOnly); if (Patch.gzFd() != NULL) { unsigned long mapSize = Patch.Size(); DynamicMMap dyn(0, mapSize, 0); gzread(Patch.gzFd(), dyn.Data(), mapSize); ed_cmds = dyn; - } + } else + ed_cmds = MMap(Patch, MMap::ReadOnly); + MMap in_file(From, MMap::ReadOnly); if (ed_cmds.Size() == 0 || in_file.Size() == 0) -- cgit v1.2.3 From 26b37f959350860a0c1d5ef9651efa0bf3640cb5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 12 Feb 2011 19:40:47 +0100 Subject: * apt-pkg/contrib/mmap.cc: - do not try to free the mapping if its is unset --- apt-pkg/contrib/mmap.cc | 2 ++ debian/changelog | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 69fb61fca..4978446d2 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -266,6 +266,8 @@ DynamicMMap::~DynamicMMap() { if (Fd == 0) { + if (Base == 0) + return; #ifdef _POSIX_MAPPED_FILES munmap(Base, WorkSpace); #else diff --git a/debian/changelog b/debian/changelog index 4f1a8afa4..f8d29abde 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,10 @@ apt (0.8.12) unstable; urgency=low marker could be lost later by the removal of rdepends (Closes: #612557) * methods/rred.cc: - read patch into MMap only if we work on uncompressed patches + * apt-pkg/contrib/mmap.cc: + - do not try to free the mapping if its is unset - -- David Kalnischkies Sat, 12 Feb 2011 13:43:11 +0100 + -- David Kalnischkies Sat, 12 Feb 2011 19:39:25 +0100 apt (0.8.11.1) unstable; urgency=low -- cgit v1.2.3 From 005428387832e79e314bb8f2605f7e6c69708d14 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 11:37:22 +0100 Subject: update size of dynamic MMap as we write in from the outside --- apt-pkg/contrib/mmap.h | 1 + debian/changelog | 3 ++- methods/rred.cc | 11 ++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h index 5ca951204..e9baa9339 100644 --- a/apt-pkg/contrib/mmap.h +++ b/apt-pkg/contrib/mmap.h @@ -61,6 +61,7 @@ class MMap inline operator void *() {return Base;}; inline void *Data() {return Base;}; inline unsigned long Size() {return iSize;}; + inline void AddSize(unsigned long const size) {iSize += size;}; // File manipulators bool Sync(); diff --git a/debian/changelog b/debian/changelog index f8d29abde..86d31d856 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,10 +9,11 @@ apt (0.8.12) unstable; urgency=low marker could be lost later by the removal of rdepends (Closes: #612557) * methods/rred.cc: - read patch into MMap only if we work on uncompressed patches + - update size of dynamic MMap as we write in from the outside * apt-pkg/contrib/mmap.cc: - do not try to free the mapping if its is unset - -- David Kalnischkies Sat, 12 Feb 2011 19:39:25 +0100 + -- David Kalnischkies Sun, 13 Feb 2011 11:36:11 +0100 apt (0.8.11.1) unstable; urgency=low diff --git a/methods/rred.cc b/methods/rred.cc index 80cd14986..9ad0e4464 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -255,9 +255,14 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/ MMap ed_cmds(MMap::ReadOnly); if (Patch.gzFd() != NULL) { unsigned long mapSize = Patch.Size(); - DynamicMMap dyn(0, mapSize, 0); - gzread(Patch.gzFd(), dyn.Data(), mapSize); - ed_cmds = dyn; + DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0); + if (dyn->Data() == 0) { + delete dyn; + return MMAP_FAILED; + } + dyn->AddSize(mapSize); + gzread(Patch.gzFd(), dyn->Data(), mapSize); + ed_cmds = *dyn; } else ed_cmds = MMap(Patch, MMap::ReadOnly); -- cgit v1.2.3 From f330c0f347619f72766069acdc24616ec5fe7147 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 13:06:03 +0100 Subject: =?UTF-8?q?*=20apt-pkg/contrib/fileutl.cc:=20=20=20-=20reorder=20t?= =?UTF-8?q?he=20loaded=20filesize=20bytes=20for=20big=20endian=20(Closes:?= =?UTF-8?q?=20#612986)=20=20=20=20=20Thanks=20to=20J=C3=B6rg=20Sommer=20fo?= =?UTF-8?q?r=20the=20detailed=20analyse!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apt-pkg/contrib/fileutl.cc | 7 ++++++- debian/changelog | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 52f517ee0..6a621e2a9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -962,9 +962,14 @@ unsigned long FileFd::Size() off_t orig_pos = lseek(iFd, 0, SEEK_CUR); if (lseek(iFd, -4, SEEK_END) < 0) return _error->Errno("lseek","Unable to seek to end of gzipped file"); + size = 0L; if (read(iFd, &size, 4) != 4) return _error->Errno("read","Unable to read original size of gzipped file"); - size &= 0xFFFFFFFF; + +#ifdef WORDS_BIGENDIAN + unsigned char const * const p = (unsigned char *) &size; + size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; +#endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) return _error->Errno("lseek","Unable to seek in gzipped file"); diff --git a/debian/changelog b/debian/changelog index 86d31d856..5efc99233 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -apt (0.8.12) unstable; urgency=low +apt (0.8.11.2) unstable; urgency=low [ David Kalnischkies ] * cmdline/apt-get.cc: @@ -12,8 +12,11 @@ apt (0.8.12) unstable; urgency=low - update size of dynamic MMap as we write in from the outside * apt-pkg/contrib/mmap.cc: - do not try to free the mapping if its is unset + * apt-pkg/contrib/fileutl.cc: + - reorder the loaded filesize bytes for big endian (Closes: #612986) + Thanks to Jörg Sommer for the detailed analyse! - -- David Kalnischkies Sun, 13 Feb 2011 11:36:11 +0100 + -- David Kalnischkies Sun, 13 Feb 2011 12:15:59 +0100 apt (0.8.11.1) unstable; urgency=low -- cgit v1.2.3 From 2cae0ccb49efbeebe33f364b61e639ebf2639bdd Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 14 Feb 2011 11:20:48 +0100 Subject: use inttypes to avoid suprises with different type sizes --- apt-pkg/contrib/fileutl.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 6a621e2a9..24e3f08d9 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -42,6 +42,10 @@ #include #include #include + +#ifndef WORDS_BIGENDIAN +#include +#endif /*}}}*/ using namespace std; @@ -967,8 +971,10 @@ unsigned long FileFd::Size() return _error->Errno("read","Unable to read original size of gzipped file"); #ifdef WORDS_BIGENDIAN - unsigned char const * const p = (unsigned char *) &size; - size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + uint32_t tmp_size = size; + uint8_t const * const p = (uint8_t const * const) &tmp_size; + tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; + size = tmp_size; #endif if (lseek(iFd, orig_pos, SEEK_SET) < 0) -- cgit v1.2.3