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 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg') 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 -- cgit v1.2.3-70-g09d2 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(-) (limited to 'apt-pkg') 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-70-g09d2 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(-) (limited to 'apt-pkg') 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-70-g09d2 From f330c0f347619f72766069acdc24616ec5fe7147 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 13 Feb 2011 13:06:03 +0100 Subject: * apt-pkg/contrib/fileutl.cc: - reorder the loaded filesize bytes for big endian (Closes: #612986) Thanks to Jörg Sommer for the detailed analyse! 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(-) (limited to 'apt-pkg') 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-70-g09d2 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(-) (limited to 'apt-pkg') 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-70-g09d2