diff options
-rw-r--r-- | apt-pkg/aptconfiguration.cc | 25 | ||||
-rw-r--r-- | apt-pkg/cacheset.cc | 7 | ||||
-rw-r--r-- | apt-pkg/cacheset.h | 4 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 6 | ||||
-rw-r--r-- | apt-pkg/contrib/sha2_internal.cc | 8 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 10 | ||||
-rw-r--r-- | apt-pkg/packagemanager.cc | 4 | ||||
-rw-r--r-- | debian/changelog | 23 | ||||
-rw-r--r-- | methods/http.cc | 2 | ||||
-rw-r--r-- | test/integration/framework | 4 | ||||
-rwxr-xr-x | test/integration/test-bug-593360-modifiers-in-names | 5 | ||||
-rwxr-xr-x | test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first | 16 | ||||
-rwxr-xr-x | test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering | 21 |
13 files changed, 108 insertions, 27 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc index d72b0c5ae..f0cd8ebc0 100644 --- a/apt-pkg/aptconfiguration.cc +++ b/apt-pkg/aptconfiguration.cc @@ -47,6 +47,7 @@ const Configuration::getCompressionTypes(bool const &Cached) { _config->CndSet("Acquire::CompressionTypes::gz","gzip"); setDefaultConfigurationForCompressors(); + std::vector<APT::Configuration::Compressor> const compressors = getCompressors(); // accept non-list order as override setting for config settings on commandline std::string const overrideOrder = _config->Find("Acquire::CompressionTypes::Order",""); @@ -63,12 +64,12 @@ const Configuration::getCompressionTypes(bool const &Cached) { if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false) continue; // ignore types we have no app ready to use - std::string const appsetting = std::string("Dir::Bin::").append(*o); - if (_config->Exists(appsetting) == true) { - std::string const app = _config->FindFile(appsetting.c_str(), ""); - if (app.empty() == false && FileExists(app) == false) - continue; - } + std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin(); + for (; c != compressors.end(); ++c) + if (c->Name == *o) + break; + if (c == compressors.end()) + continue; types.push_back(*o); } @@ -84,12 +85,12 @@ const Configuration::getCompressionTypes(bool const &Cached) { if (std::find(types.begin(),types.end(),Types->Tag) != types.end()) continue; // ignore types we have no app ready to use - std::string const appsetting = std::string("Dir::Bin::").append(Types->Value); - if (appsetting.empty() == false && _config->Exists(appsetting) == true) { - std::string const app = _config->FindFile(appsetting.c_str(), ""); - if (app.empty() == false && FileExists(app) == false) - continue; - } + std::vector<APT::Configuration::Compressor>::const_iterator c = compressors.begin(); + for (; c != compressors.end(); ++c) + if (c->Name == Types->Value) + break; + if (c == compressors.end()) + continue; types.push_back(Types->Tag); } diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index b892ab4bf..e2dbe0e57 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -217,6 +217,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P pkgCacheFile &Cache, const char * cmdline, std::list<Modifier> const &mods, CacheSetHelper &helper) { std::string str = cmdline; + unsigned short fallback = modID; bool modifierPresent = false; for (std::list<Modifier>::const_iterator mod = mods.begin(); mod != mods.end(); ++mod) { @@ -243,6 +244,7 @@ bool PackageContainerInterface::FromModifierCommandLine(unsigned short &modID, P helper.showErrors(errors); if (Pkg.end() == false) { pci->insert(Pkg); + modID = fallback; return true; } } @@ -281,13 +283,14 @@ bool VersionContainerInterface::FromModifierCommandLine(unsigned short &modID, modifierPresent = true; break; } - if (modifierPresent == true) { bool const errors = helper.showErrors(false); bool const found = VersionContainerInterface::FromString(vci, Cache, cmdline, select, helper, true); helper.showErrors(errors); - if (found == true) + if (found == true) { + modID = fallback; return true; + } } return FromString(vci, Cache, str, select, helper); } diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h index 6f0a0e358..5b9900603 100644 --- a/apt-pkg/cacheset.h +++ b/apt-pkg/cacheset.h @@ -186,7 +186,7 @@ public: /*{{{*/ pkgCache::PkgIterator getPkg(void) const { return *_iter; } inline pkgCache::PkgIterator operator*(void) const { return *_iter; }; operator typename Container::iterator(void) const { return _iter; } - operator typename PackageContainer<Container>::const_iterator() { return PackageContainer<Container>::const_iterator(_iter); } + operator typename PackageContainer<Container>::const_iterator() { return typename PackageContainer<Container>::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; @@ -506,7 +506,7 @@ public: /*{{{*/ pkgCache::VerIterator getVer(void) const { return *_iter; } inline pkgCache::VerIterator operator*(void) const { return *_iter; }; operator typename Container::iterator(void) const { return _iter; } - operator typename VersionContainer<Container>::const_iterator() { return VersionContainer<Container>::const_iterator(_iter); } + operator typename VersionContainer<Container>::const_iterator() { return typename VersionContainer<Container>::const_iterator(_iter); } inline iterator& operator++() { ++_iter; return *this; } inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; } inline bool operator!=(iterator const &i) const { return _iter != i._iter; }; diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 9e3611b26..e9d1ba1ce 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1098,6 +1098,12 @@ bool FileFd::OpenInternDescriptor(unsigned int const Mode, APT::Configuration::C dup2(d->compressed_fd,STDIN_FILENO); dup2(Pipe[1],STDOUT_FILENO); } + int const nullfd = open("/dev/null", O_WRONLY); + if (nullfd != -1) + { + dup2(nullfd,STDERR_FILENO); + close(nullfd); + } SetCloseExec(STDOUT_FILENO,false); SetCloseExec(STDIN_FILENO,false); diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc index 6d27e8f2b..83b5a98d3 100644 --- a/apt-pkg/contrib/sha2_internal.cc +++ b/apt-pkg/contrib/sha2_internal.cc @@ -552,7 +552,9 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { } while (len >= SHA256_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA256_Transform(context, (sha2_word32*)data); + sha2_byte buffer[SHA256_BLOCK_LENGTH]; + MEMCPY_BCOPY(buffer, data, SHA256_BLOCK_LENGTH); + SHA256_Transform(context, (sha2_word32*)buffer); context->bitcount += SHA256_BLOCK_LENGTH << 3; len -= SHA256_BLOCK_LENGTH; data += SHA256_BLOCK_LENGTH; @@ -879,7 +881,9 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { } while (len >= SHA512_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA512_Transform(context, (sha2_word64*)data); + sha2_byte buffer[SHA512_BLOCK_LENGTH]; + MEMCPY_BCOPY(buffer, data, SHA512_BLOCK_LENGTH); + SHA512_Transform(context, (sha2_word64*)buffer); ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); len -= SHA512_BLOCK_LENGTH; data += SHA512_BLOCK_LENGTH; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 84e6c38c5..00e2bd900 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -249,8 +249,14 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg, return false; if (strcmp(Pkg.Name(),"apt") == 0) - Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important; - + { + if ((essential == "native" && Pkg->Arch != 0 && myArch == Pkg.Arch()) || + essential == "all") + Pkg->Flags |= pkgCache::Flag::Essential | pkgCache::Flag::Important; + else + Pkg->Flags |= pkgCache::Flag::Important; + } + if (ParseStatus(Pkg,Ver) == false) return false; return true; diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 093999bc2..b56619ef5 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -621,7 +621,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c // Look for easy targets: packages that are already okay for (DepIterator Cur = Start; Bad == true; ++Cur) { - SPtrArray<Version *> VList = Start.AllTargets(); + SPtrArray<Version *> VList = Cur.AllTargets(); for (Version **I = VList; *I != 0; ++I) { VerIterator Ver(Cache,*I); @@ -644,7 +644,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c // Look for something that could be configured. for (DepIterator Cur = Start; Bad == true; ++Cur) { - SPtrArray<Version *> VList = Start.AllTargets(); + SPtrArray<Version *> VList = Cur.AllTargets(); for (Version **I = VList; *I != 0; ++I) { VerIterator Ver(Cache,*I); diff --git a/debian/changelog b/debian/changelog index f401f312c..2f5a3dc5c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,22 @@ apt (0.9.2) UNRELEASED; urgency=low that the pipe is closed when InFd is closed. This fixes a Fd leak (LP: #985452) + [ David Kalnischkies ] + * apt-pkg/deb/deblistparser.cc: + - only treat the native apt as essential by default (Closes: #669377) + * apt-pkg/contrib/fileutl.cc: + - redirect stderr from compressors to /dev/null + * apt-pkg/aptconfiguration.cc: + - if the compressor is not installed, but we link against it's + library accept it as a CompressionType (Closes: #669328) + * apt-pkg/contrib/sha2_internal.cc: + - do not use the input data directly but memcpy it instead as + it could be unaligned as in the http-transport which causes + a sigbus error on sparc (Closes: #669061) + * apt-pkg/cacheset.cc: + - actually return to the fallback modifier if we have detected we + should for packagenames which look like modifiers (Closes: #669591) + [ Adam Conrad ] * Set FD_CLOEXEC on history.log's FD (Closes: #610069, LP: #636010) @@ -13,7 +29,12 @@ apt (0.9.2) UNRELEASED; urgency=low * apt-pkg/deb/dpkgpm.cc: - do not crash if (*I).Pkg is NULL (LP: #939867) - -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 20 Apr 2012 09:13:19 +0200 + [ Malcolm Scott ] + * apt-pkg/packagemanager.cc: + - iterate over all pre-depends or-group member instead of looping + endlessly over the first member in SmartUnpack (LP: #985852) + + -- David Kalnischkies <kalnischkies@gmail.com> Fri, 20 Apr 2012 10:11:24 +0200 apt (0.9.1) unstable; urgency=low diff --git a/methods/http.cc b/methods/http.cc index c62ca71d3..b450b6ffc 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -602,7 +602,7 @@ bool ServerState::HeaderLine(string Line) return true; Size = strtoull(Val.c_str(), NULL, 10); - if (Size == ULLONG_MAX) + if (Size >= std::numeric_limits<unsigned long long>::max()) return _error->Errno("HeaderLine", _("The HTTP server sent an invalid Content-Length header")); return true; } diff --git a/test/integration/framework b/test/integration/framework index 0670d6a78..b80b02922 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -151,7 +151,7 @@ setupenvironment() { echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf - if ! $(which dpkg) --assert-multi-arch; then + if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… fi echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf @@ -199,7 +199,7 @@ configdpkg() { echo -n > rootdir/var/lib/dpkg/status fi fi - if $(which dpkg) --assert-multi-arch; then + if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then local ARCHS="$(getarchitectures)" if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then DPKGARCH="$(dpkg --print-architecture)" diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names index 83a3cfabf..74826cbdb 100755 --- a/test/integration/test-bug-593360-modifiers-in-names +++ b/test/integration/test-bug-593360-modifiers-in-names @@ -15,6 +15,11 @@ The following NEW packages will be installed: Inst g++ (4:4.4.5-1 localhost [i386]) Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s +testequal "Reading package lists... +Building dependency tree... +Package 'g++' is not installed, so not removed +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove g++ -s + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: diff --git a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first index a9a4069cf..269038d0f 100755 --- a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first +++ b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first @@ -14,7 +14,7 @@ insertpackage 'unstable' 'apt' 'i386' '2' 'Depends: libsame (= 2)' setupaptarchive -testequal 'Reading package lists... +testequalor2 'Reading package lists... Building dependency tree... The following extra packages will be installed: apt:i386 libsame:i386 @@ -28,4 +28,18 @@ Inst libsame (2 unstable [amd64]) [apt:i386 ] Conf libsame:i386 (2 unstable [i386]) [apt:i386 ] Conf libsame (2 unstable [amd64]) [apt:i386 ] Inst apt:i386 [1] (2 unstable [i386]) +Conf apt:i386 (2 unstable [i386])' 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + apt:i386 libsame:i386 +The following NEW packages will be installed: + libsame +The following packages will be upgraded: + apt:i386 libsame:i386 +2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst apt:i386 [1] (2 unstable [i386]) [] +Inst libsame:i386 [1] (2 unstable [i386]) +Inst libsame (2 unstable [amd64]) +Conf libsame:i386 (2 unstable [i386]) +Conf libsame (2 unstable [amd64]) Conf apt:i386 (2 unstable [i386])' aptget install libsame:amd64 -s diff --git a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering new file mode 100755 index 000000000..462acad00 --- /dev/null +++ b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'custom' 'amd64' '1.0' 'Pre-Depends: grub-pc | grub' +insertinstalledpackage 'grub' 'amd64' '1.0' +insertpackage 'unstable' 'custom' 'amd64' '2.0' 'Pre-Depends: grub-pc | grub' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + custom +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst custom [1.0] (2.0 unstable [amd64]) +Conf custom (2.0 unstable [amd64])' aptget dist-upgrade -s |