diff options
46 files changed, 308 insertions, 76 deletions
diff --git a/.gitignore b/.gitignore index 7baa7fbeb..398ff57ff 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,15 @@ gtest-* !/po/apt-all.pot # Vendor files - **/vendor/sources.list **/LC_MESSAGES/ +# docbook stylesheets (generated from .cmake.in) +docbook-html-style.xsl +manpage-style.xsl +docbook-text-style.xsl + +# Programs **/ftparchive/apt-ftparchive **/cmdline/apt **/cmdline/apt-cache diff --git a/CMakeLists.txt b/CMakeLists.txt index c29c27e27..a26b32d71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,7 @@ endif() # Configure some variables like package, version and architecture. set(PACKAGE ${PROJECT_NAME}) set(PACKAGE_MAIL "APT Development Team <deity@lists.debian.org>") -set(PACKAGE_VERSION "1.3~rc3ubuntu2") +set(PACKAGE_VERSION "1.3~rc4") if (NOT DEFINED COMMON_ARCH) execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt index 34930c8e9..bdaa93d67 100644 --- a/apt-pkg/CMakeLists.txt +++ b/apt-pkg/CMakeLists.txt @@ -29,7 +29,7 @@ target_include_directories(apt-pkg ${BZIP2_INCLUDE_DIR} ${LZMA_INCLUDE_DIRS} ${LZ4_INCLUDE_DIRS} - ${ICONV_DIRECTORIES} + ${ICONV_INCLUDE_DIRS} ) target_link_libraries(apt-pkg diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 0e1614330..bf1c68d82 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1019,6 +1019,28 @@ bool pkgAcquire::Item::IsRedirectionLoop(std::string const &NewURI) /*{{{*/ } /*}}}*/ + /*}}}*/ +int pkgAcquire::Item::Priority() /*{{{*/ +{ + // Stage 1: Meta indices and diff indices + // - those need to be fetched first to have progress reporting working + // for the rest + if (dynamic_cast<pkgAcqMetaSig*>(this) != nullptr + || dynamic_cast<pkgAcqMetaBase*>(this) != nullptr + || dynamic_cast<pkgAcqDiffIndex*>(this) != nullptr) + return 1000; + // Stage 2: Diff files + // - fetch before complete indexes so we can apply the diffs while fetching + // larger files. + if (dynamic_cast<pkgAcqIndexDiffs*>(this) != nullptr || + dynamic_cast<pkgAcqIndexMergeDiffs*>(this) != nullptr) + return 800; + + // Stage 3: The rest - complete index files and other stuff + return 500; +} + /*}}}*/ + pkgAcqTransactionItem::pkgAcqTransactionItem(pkgAcquire * const Owner, /*{{{*/ pkgAcqMetaClearSig * const transactionManager, IndexTarget const &target) : pkgAcquire::Item(Owner), d(NULL), Target(target), TransactionManager(transactionManager) diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 71a11bcde..26e1a1922 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -305,6 +305,8 @@ class pkgAcquire::Item : public WeakPointable /*{{{*/ virtual ~Item(); bool APT_HIDDEN IsRedirectionLoop(std::string const &NewURI); + /** \brief The priority of the item, used for queuing */ + int APT_HIDDEN Priority(); protected: /** \brief The acquire object with which this item is associated. */ diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index b4d1b5959..2ad6bc47f 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -894,9 +894,10 @@ pkgAcquire::Queue::~Queue() /* */ bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) { + QItem **OptimalI = &Items; QItem **I = &Items; // move to the end of the queue and check for duplicates here - for (; *I != 0; I = &(*I)->Next) + for (; *I != 0; ) { if (Item.URI == (*I)->URI) { if (_config->FindB("Debug::pkgAcquire::Worker",false) == true) @@ -905,12 +906,22 @@ bool pkgAcquire::Queue::Enqueue(ItemDesc &Item) Item.Owner->Status = (*I)->Owner->Status; return false; } + // Determine the optimal position to insert: before anything with a + // higher priority. + int priority = (*I)->GetPriority(); + + I = &(*I)->Next; + if (priority >= Item.Owner->Priority()) { + OptimalI = I; + } + } + // Create a new item QItem *Itm = new QItem; *Itm = Item; - Itm->Next = 0; - *I = Itm; + Itm->Next = *OptimalI; + *OptimalI = Itm; Item.Owner->QueueCounter++; if (Items->Next == 0) @@ -1060,16 +1071,24 @@ bool pkgAcquire::Queue::Cycle() // Look for a queable item QItem *I = Items; + int ActivePriority = 0; while (PipeDepth < (signed)MaxPipeDepth) { - for (; I != 0; I = I->Next) + for (; I != 0; I = I->Next) { + if (I->Owner->Status == pkgAcquire::Item::StatFetching) + ActivePriority = std::max(ActivePriority, I->GetPriority()); if (I->Owner->Status == pkgAcquire::Item::StatIdle) break; + } // Nothing to do, queue is idle. if (I == 0) return true; + // This item has a lower priority than stuff in the pipeline, pretend + // the queue is idle + if (I->GetPriority() < ActivePriority) + return true; I->Worker = Workers; for (auto const &O: I->Owners) O->Status = pkgAcquire::Item::StatFetching; @@ -1135,6 +1154,15 @@ APT_PURE unsigned long long pkgAcquire::Queue::QItem::GetMaximumSize() const /*{ return Maximum; } /*}}}*/ +APT_PURE int pkgAcquire::Queue::QItem::GetPriority() const /*{{{*/ +{ + int Priority = 0; + for (auto const &O: Owners) + Priority = std::max(Priority, O->Priority()); + + return Priority; +} + /*}}}*/ void pkgAcquire::Queue::QItem::SyncDestinationFiles() const /*{{{*/ { /* ensure that the first owner has the best partial file of all and diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 7044797b3..1fae662f8 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -464,6 +464,8 @@ class pkgAcquire::Queue /** @return the custom headers to use for this item */ std::string Custom600Headers() const; + /** @return the maximum priority of this item */ + int APT_HIDDEN GetPriority() const; }; /** \brief The name of this queue. */ diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 755ad2035..662c2bf8b 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -312,6 +312,8 @@ public: // Hashes::Add* - Add the contents of data or FD /*{{{*/ bool Hashes::Add(const unsigned char * const Data, unsigned long long const Size) { + if (Size == 0) + return true; bool Res = true; APT_IGNORE_DEPRECATED_PUSH if ((d->CalcHashes & MD5SUM) == MD5SUM) diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 9bfc32c54..1fe0afc00 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -195,11 +195,11 @@ class Hashes static const int UntilEOF = 0; - bool Add(const unsigned char * const Data, unsigned long long const Size); - APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes); - inline bool Add(const char * const Data) + bool Add(const unsigned char * const Data, unsigned long long const Size) APT_NONNULL(2); + APT_DEPRECATED_MSG("Construct accordingly instead of choosing hashes while adding") bool Add(const unsigned char * const Data, unsigned long long const Size, unsigned int const Hashes) APT_NONNULL(2); + inline bool Add(const char * const Data) APT_NONNULL(2) {return Add((unsigned char const * const)Data,strlen(Data));}; - inline bool Add(const unsigned char * const Beg,const unsigned char * const End) + inline bool Add(const unsigned char * const Beg,const unsigned char * const End) APT_NONNULL(2,3) {return Add(Beg,End-Beg);}; enum SupportedHashes { MD5SUM = (1 << 0), SHA1SUM = (1 << 1), SHA256SUM = (1 << 2), diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 4000f230d..e5032d02f 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -122,18 +122,18 @@ class HashSumValue class SummationImplementation { public: - virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) = 0; - inline bool Add(const char *inbuf, unsigned long long const inlen) + virtual bool Add(const unsigned char *inbuf, unsigned long long inlen) APT_NONNULL(2) = 0; + inline bool Add(const char *inbuf, unsigned long long const inlen) APT_NONNULL(2) { return Add((const unsigned char *)inbuf, inlen); } - inline bool Add(const unsigned char *Data) + inline bool Add(const unsigned char *Data) APT_NONNULL(2) { return Add(Data, strlen((const char *)Data)); } - inline bool Add(const char *Data) + inline bool Add(const char *Data) APT_NONNULL(2) { return Add((const unsigned char *)Data, strlen(Data)); } - inline bool Add(const unsigned char *Beg, const unsigned char *End) + inline bool Add(const unsigned char *Beg, const unsigned char *End) APT_NONNULL(2,3) { return Add(Beg, End - Beg); } - inline bool Add(const char *Beg, const char *End) + inline bool Add(const char *Beg, const char *End) APT_NONNULL(2,3) { return Add((const unsigned char *)Beg, End - Beg); } bool AddFD(int Fd, unsigned long long Size = 0); diff --git a/apt-pkg/contrib/md5.cc b/apt-pkg/contrib/md5.cc index b487a96f9..ff7868fe2 100644 --- a/apt-pkg/contrib/md5.cc +++ b/apt-pkg/contrib/md5.cc @@ -187,6 +187,8 @@ bool MD5Summation::Add(const unsigned char *data,unsigned long long len) { if (Done == true) return false; + if (len == 0) + return true; uint32_t *buf = (uint32_t *)Buf; uint32_t *bytes = (uint32_t *)Bytes; diff --git a/apt-pkg/contrib/md5.h b/apt-pkg/contrib/md5.h index a16ea4d2d..a286f092a 100644 --- a/apt-pkg/contrib/md5.h +++ b/apt-pkg/contrib/md5.h @@ -48,7 +48,7 @@ class MD5Summation : public SummationImplementation public: - bool Add(const unsigned char *inbuf, unsigned long long inlen) APT_OVERRIDE; + bool Add(const unsigned char *inbuf, unsigned long long inlen) APT_OVERRIDE APT_NONNULL(2); using SummationImplementation::Add; MD5SumValue Result(); diff --git a/apt-pkg/contrib/sha1.cc b/apt-pkg/contrib/sha1.cc index bf6bc6cb6..298a7799b 100644 --- a/apt-pkg/contrib/sha1.cc +++ b/apt-pkg/contrib/sha1.cc @@ -243,6 +243,8 @@ bool SHA1Summation::Add(const unsigned char *data,unsigned long long len) { if (Done) return false; + if (len == 0) + return true; uint32_t *state = (uint32_t *)State; uint32_t *count = (uint32_t *)Count; diff --git a/apt-pkg/contrib/sha1.h b/apt-pkg/contrib/sha1.h index 1c5cb5aa1..3387c1cfd 100644 --- a/apt-pkg/contrib/sha1.h +++ b/apt-pkg/contrib/sha1.h @@ -37,7 +37,7 @@ class SHA1Summation : public SummationImplementation bool Done; public: - bool Add(const unsigned char *inbuf, unsigned long long inlen) APT_OVERRIDE; + bool Add(const unsigned char *inbuf, unsigned long long inlen) APT_OVERRIDE APT_NONNULL(2); using SummationImplementation::Add; SHA1SumValue Result(); diff --git a/apt-pkg/contrib/sha2.h b/apt-pkg/contrib/sha2.h index 8b4bdd439..164840d3b 100644 --- a/apt-pkg/contrib/sha2.h +++ b/apt-pkg/contrib/sha2.h @@ -34,7 +34,7 @@ class SHA2SummationBase : public SummationImplementation protected: bool Done; public: - bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE = 0; + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2) = 0; void Result(); }; @@ -45,7 +45,7 @@ class SHA256Summation : public SHA2SummationBase unsigned char Sum[32]; public: - bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2) { if (Done) return false; @@ -78,7 +78,7 @@ class SHA512Summation : public SHA2SummationBase unsigned char Sum[64]; public: - bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE + bool Add(const unsigned char *inbuf, unsigned long long len) APT_OVERRIDE APT_NONNULL(2) { if (Done) return false; diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 66b0078dc..cf8feb970 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1171,10 +1171,11 @@ bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len) tar files */ bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len) { - unsigned long long Num; + unsigned long long Num = 0; bool rc; rc = Base256ToNum(Str, Num, Len); + // rudimentary check for overflow (Res = ulong, Num = ulonglong) Res = Num; if (Res != Num) return false; diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc index 5454d79c3..d296161d6 100644 --- a/apt-pkg/deb/debsrcrecords.cc +++ b/apt-pkg/deb/debsrcrecords.cc @@ -73,9 +73,12 @@ const char **debSrcRecordParser::Binaries() char* bin = Buffer; do { char* binStartNext = strchrnul(bin, ','); - char* binEnd = binStartNext - 1; - for (; isspace_ascii(*binEnd) != 0; --binEnd) - binEnd = 0; + // Found a comma, clean up any space before it + if (binStartNext > Buffer) { + char* binEnd = binStartNext - 1; + for (; binEnd > Buffer && isspace_ascii(*binEnd) != 0; --binEnd) + *binEnd = 0; + } StaticBinList.push_back(bin); if (*binStartNext != ',') break; diff --git a/debian/apt.dirs b/debian/apt.dirs index bdc5adddb..54adcaa05 100644 --- a/debian/apt.dirs +++ b/debian/apt.dirs @@ -1 +1,2 @@ etc/kernel/postinst.d +usr/share/bug/apt diff --git a/debian/changelog b/debian/changelog index 257219b4a..0043bfc88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,24 @@ +apt (1.3~rc4) unstable; urgency=medium + + [ Julian Andres Klode ] + * Fix segfault and out-of-bounds read in Binary fields + * TagFile: Fix off-by-one errors in comment stripping + * Base256ToNum: Fix uninitialized value + * test-apt-cdrom: Fix for gnupg 2.1.15 + * CMake: test/libapt: Use a prebuilt GTest library if available + * CMake: apt-pkg: Use correct ICONV_INCLUDE_DIRS variable + * acquire: Use priority queues and a 3 stage pipeline design + => faster updates with better progress reporting + * debian: Move bugscript to old location for overlayfs xdev issue + * debian: Pass -O to make to get readable build logs + + [ David Kalnischkies ] + * try not to call memcpy with length 0 in hash calculations + * re-add apt breaks/replaces apt-utils (<< 1.3~exp2~) (Closes: #836220) + * support long keyid and fingerprint in gpgv's GOODSIG + + -- Julian Andres Klode <jak@debian.org> Fri, 02 Sep 2016 20:26:36 +0200 + apt (1.3~rc3ubuntu2) yakkety; urgency=medium * test-apt-cdrom: Fix for gnupg 2.1.15 diff --git a/debian/control b/debian/control index 582259e20..772339511 100644 --- a/debian/control +++ b/debian/control @@ -36,6 +36,8 @@ Depends: adduser, ${apt:keyring}, ${misc:Depends}, ${shlibs:Depends} +Replaces: apt-utils (<< 1.3~exp2~) +Breaks: apt-utils (<< 1.3~exp2~) Recommends: gnupg | gnupg2 | gnupg1 Suggests: apt-doc, aptitude | synaptic | wajig, diff --git a/debian/rules b/debian/rules index 24608a6b8..2f1ea45fc 100755 --- a/debian/rules +++ b/debian/rules @@ -34,3 +34,6 @@ override_dh_auto_configure-arch: flags=-DWITH_DOC=OFF override_dh_auto_configure-indep: flags=-DWITH_DOC=ON override_dh_auto_configure-arch override_dh_auto_configure-indep: dh_auto_configure -- $(flags) + +override_dh_auto_build: + dh_auto_build -- -O diff --git a/doc/apt-cache.8.xml b/doc/apt-cache.8.xml index b425019ee..5c16ce851 100644 --- a/doc/apt-cache.8.xml +++ b/doc/apt-cache.8.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; <!-- The last update date --> - <date>2016-09-01T00:00:00Z</date> + <date>2016-08-30T00:00:00Z</date> </refentryinfo> <refmeta> diff --git a/doc/apt-get.8.xml b/doc/apt-get.8.xml index b21a8219b..09a5ba950 100644 --- a/doc/apt-get.8.xml +++ b/doc/apt-get.8.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; <!-- The last update date --> - <date>2016-09-01T00:00:00Z</date> + <date>2016-08-30T00:00:00Z</date> </refentryinfo> <refmeta> diff --git a/doc/apt-verbatim.ent b/doc/apt-verbatim.ent index 47b3c23cd..a516276e9 100644 --- a/doc/apt-verbatim.ent +++ b/doc/apt-verbatim.ent @@ -239,7 +239,7 @@ "> <!-- this will be updated by 'prepare-release' --> -<!ENTITY apt-product-version "1.3~rc3ubuntu2"> +<!ENTITY apt-product-version "1.3~rc4"> <!-- (Code)names for various things used all over the place --> <!ENTITY debian-oldstable-codename "wheezy"> diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index 4740b7630..ca0203468 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -19,7 +19,7 @@ &apt-email; &apt-product; <!-- The last update date --> - <date>2016-09-01T00:00:00Z</date> + <date>2016-08-30T00:00:00Z</date> </refentryinfo> <refmeta> diff --git a/doc/po/apt-doc.pot b/doc/po/apt-doc.pot index 870f32708..81b7036ba 100644 --- a/doc/po/apt-doc.pot +++ b/doc/po/apt-doc.pot @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: apt-doc 1.3~rc3ubuntu1\n" +"Project-Id-Version: apt-doc 1.3~rc4\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/doc/po/de.po b/doc/po/de.po index d61576b01..7557f4e2a 100644 --- a/doc/po/de.po +++ b/doc/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.8\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2014-09-14 14:46+0200\n" "Last-Translator: Chris Leick <c.leick@vollbio.de>\n" "Language-Team: German <debian-l10n-german@lists.debian.org>\n" diff --git a/doc/po/es.po b/doc/po/es.po index 86561d293..d22436df6 100644 --- a/doc/po/es.po +++ b/doc/po/es.po @@ -38,7 +38,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2014-07-04 01:31+0200\n" "Last-Translator: Omar Campagne <ocampagne@gmail.com>\n" "Language-Team: Debian l10n Spanish <debian-l10n-spanish@lists.debian.org>\n" diff --git a/doc/po/fr.po b/doc/po/fr.po index 3608a32fc..b56c007b5 100644 --- a/doc/po/fr.po +++ b/doc/po/fr.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2014-11-15 17:26+0100\n" "Last-Translator: Jean-Pierre Giraud <jean-pierregiraud@neuf.fr>\n" "Language-Team: French <debian-l10n-french@lists.debian.org>\n" diff --git a/doc/po/it.po b/doc/po/it.po index 077f6116a..33f963206 100644 --- a/doc/po/it.po +++ b/doc/po/it.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2015-12-27 21:26+0200\n" "Last-Translator: Beatrice Torracca <beatricet@libero.it>\n" "Language-Team: Italian <debian-l10n-italian@lists.debian.org>\n" diff --git a/doc/po/ja.po b/doc/po/ja.po index 3ac212fc2..2dd1b0a97 100644 --- a/doc/po/ja.po +++ b/doc/po/ja.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.6\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2016-03-23 09:39+0900\n" "Last-Translator: Takuma Yamada <tyamada@takumayamada.com>\n" "Language-Team: Japanese <debian-japanese@lists.debian.org>\n" diff --git a/doc/po/nl.po b/doc/po/nl.po index 442726aee..0876debd0 100644 --- a/doc/po/nl.po +++ b/doc/po/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.1.10-nl\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2016-02-01 16:17+0100\n" "Last-Translator: Frans Spiesschaert <Frans.Spiesschaert@yucom.be>\n" "Language-Team: Debian Dutch l10n Team <debian-l10n-dutch@lists.debian.org>\n" diff --git a/doc/po/pl.po b/doc/po/pl.po index 107816e84..1e674aa30 100644 --- a/doc/po/pl.po +++ b/doc/po/pl.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2014-07-04 02:13+0200\n" "Last-Translator: Robert Luberda <robert@debian.org>\n" "Language-Team: Polish <manpages-pl-list@lists.sourceforge.net>\n" diff --git a/doc/po/pt.po b/doc/po/pt.po index 9d01cf453..9498e9f98 100644 --- a/doc/po/pt.po +++ b/doc/po/pt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.7\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2014-08-29 00:34+0100\n" "Last-Translator: Américo Monteiro <a_monteiro@gmx.com>\n" "Language-Team: Portuguese <traduz@debianpt.org>\n" diff --git a/doc/po/pt_BR.po b/doc/po/pt_BR.po index 67a3523b3..d65fe15f0 100644 --- a/doc/po/pt_BR.po +++ b/doc/po/pt_BR.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: apt-doc 1.0.5\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: 2004-09-20 17:02+0000\n" "Last-Translator: André Luís Lopes <andrelop@debian.org>\n" "Language-Team: <debian-l10n-portuguese@lists.debian.org>\n" diff --git a/doc/sources.list.5.xml b/doc/sources.list.5.xml index 7b27641e1..bfc97e705 100644 --- a/doc/sources.list.5.xml +++ b/doc/sources.list.5.xml @@ -14,7 +14,7 @@ &apt-email; &apt-product; <!-- The last update date --> - <date>2016-09-01T00:00:00Z</date> + <date>2016-08-30T00:00:00Z</date> </refentryinfo> <refmeta> diff --git a/methods/gpgv.cc b/methods/gpgv.cc index f2ef6b76e..d073c733e 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -258,16 +258,32 @@ string GPGVMethod::VerifyGetSigners(const char *file, const char *outfile, if (std::find(ValidSigners.begin(), ValidSigners.end(), k) == ValidSigners.end()) continue; // we look for GOODSIG here as well as an expired sig is a valid sig as well (but not a good one) + std::string const goodfingerprint = "GOODSIG " + k; std::string const goodlongkeyid = "GOODSIG " + k.substr(24, 16); - foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodlongkeyid) != GoodSigners.end(); + foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodfingerprint) != GoodSigners.end(); if (Debug == true) - std::clog << "Key " << k << " is valid sig, is " << goodlongkeyid << " also a good one? " << (foundGood ? "yes" : "no") << std::endl; + std::clog << "Key " << k << " is valid sig, is " << goodfingerprint << " also a good one? " << (foundGood ? "yes" : "no") << std::endl; + std::string goodsig; + if (foundGood == false) + { + foundGood = std::find(GoodSigners.begin(), GoodSigners.end(), goodlongkeyid) != GoodSigners.end(); + if (Debug == true) + std::clog << "Key " << k << " is valid sig, is " << goodlongkeyid << " also a good one? " << (foundGood ? "yes" : "no") << std::endl; + goodsig = goodlongkeyid; + } + else + goodsig = goodfingerprint; if (foundGood == false) continue; std::copy(GoodSigners.begin(), GoodSigners.end(), std::back_insert_iterator<std::vector<std::string> >(NoPubKeySigners)); GoodSigners.clear(); - GoodSigners.push_back(goodlongkeyid); - NoPubKeySigners.erase(std::remove(NoPubKeySigners.begin(), NoPubKeySigners.end(), goodlongkeyid), NoPubKeySigners.end()); + GoodSigners.push_back(goodsig); + NoPubKeySigners.erase( + std::remove(NoPubKeySigners.begin(), + std::remove(NoPubKeySigners.begin(), NoPubKeySigners.end(), goodfingerprint), + goodlongkeyid), + NoPubKeySigners.end() + ); break; } if (foundGood == false) diff --git a/methods/rred.cc b/methods/rred.cc index 0c641ad82..958933a07 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -335,7 +335,7 @@ class Patch { FileChanges filechanges; MemBlock add_text; - static bool retry_fwrite(char *b, size_t l, FileFd &f, Hashes * const start_hash, Hashes * const end_hash = nullptr) + static bool retry_fwrite(char *b, size_t l, FileFd &f, Hashes * const start_hash, Hashes * const end_hash = nullptr) APT_NONNULL(1) { if (f.Write(b, l) == false) return false; @@ -385,8 +385,8 @@ class Patch { } } - static void dump_mem(FileFd &o, char *p, size_t s, Hashes *hash) { - retry_fwrite(p, s, o, hash); + static void dump_mem(FileFd &o, char *p, size_t s, Hashes *hash) APT_NONNULL(2) { + retry_fwrite(p, s, o, nullptr, hash); } public: @@ -538,7 +538,8 @@ class Patch { for (ch = filechanges.begin(); ch != filechanges.end(); ++ch) { dump_lines(out, in, ch->offset, start_hash, end_hash); skip_lines(in, ch->del_cnt, start_hash); - dump_mem(out, ch->add, ch->add_len, end_hash); + if (ch->add_len != 0) + dump_mem(out, ch->add, ch->add_len, end_hash); } dump_rest(out, in, start_hash, end_hash); out.Flush(); diff --git a/po/apt-all.pot b/po/apt-all.pot index 270344a6c..812cd357f 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: apt 1.3~rc3ubuntu1\n" +"Project-Id-Version: apt 1.3~rc4\n" "Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n" -"POT-Creation-Date: 2016-09-01 00:57+0200\n" +"POT-Creation-Date: 2016-09-02 20:30+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822 index abb31b793..f19f263d0 100755 --- a/test/integration/test-apt-sources-deb822 +++ b/test/integration/test-apt-sources-deb822 @@ -98,10 +98,10 @@ echo "$BASE" > $SOURCES echo "" >> $SOURCES echo "$BASE" | sed s/stable/unstable/ >> $SOURCES testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 -'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-all_Packages 0 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris @@ -110,10 +110,10 @@ testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' msgcleantest 'Test deb822 with' 'two Suite entries' echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES testsuccessequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 +'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 'http://ftp.debian.org/debian/dists/stable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_stable_main_binary-all_Packages 0 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 -'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0 'http://ftp.debian.org/debian/dists/unstable/main/binary-all/Packages.xz' ftp.debian.org_debian_dists_unstable_main_binary-all_Packages 0 'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.xz' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris diff --git a/test/integration/test-method-gpgv b/test/integration/test-method-gpgv new file mode 100755 index 000000000..86559b7cb --- /dev/null +++ b/test/integration/test-method-gpgv @@ -0,0 +1,77 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'i386' + +cat > faked-apt-key <<EOF +#!/bin/sh +set -e +echo "FFOO" +find_gpgv_status_fd() { + while [ -n "\$1" ]; do + if [ "\$1" = '--status-fd' ]; then + shift + echo "\$1" + break + fi + shift + done +} +GPGSTATUSFD="\$(find_gpgv_status_fd "\$@")" +cat >&\${GPGSTATUSFD} gpgv.output +cat gpgv.output +EOF +chmod +x faked-apt-key + +testgpgv() { + echo "$3" > gpgv.output + msgtest "$1" "$2" + gpgvmethod >method.output 2>&1 || true + testsuccess --nomsg grep "$2" method.output +} + +testrun() { + testgpgv 'Good signed with long keyid' 'Good: GOODSIG 5A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> +[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE' + testgpgv 'Good signed with fingerprint' 'Good: GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org> +[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE' + + testgpgv 'No Pubkey with long keyid' 'NoPubKey: NO_PUBKEY E8525D47528144E2,' '[GNUPG:] ERRSIG E8525D47528144E2 1 11 00 1472744666 9 +[GNUPG:] NO_PUBKEY E8525D47528144E2' + testgpgv 'No Pubkey with fingerprint' 'NoPubKey: NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2,' '[GNUPG:] ERRSIG DE66AECA9151AFA1877EC31DE8525D47528144E2 1 11 00 1472744666 9 +[GNUPG:] NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2' + + testgpgv 'Expired key with long keyid' 'Worthless: EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org> +[GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9' + testgpgv 'Expired key with fingerprint' 'Worthless: EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org> +[GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9' +} + +gpgvmethod() { + echo '601 Configuration +Config-Item: Debug::Acquire::gpgv=1 +Config-Item: Dir::Bin::apt-key=./faked-apt-key + +600 URI Acquire +URI: file:///dev/null +Filename: /dev/zero +' | runapt "${METHODSDIR}/gpgv" +} +testrun + +gpgvmethod() { + echo '601 Configuration +Config-Item: Debug::Acquire::gpgv=1 +Config-Item: Dir::Bin::apt-key=./faked-apt-key + +600 URI Acquire +URI: file:///dev/null +Filename: /dev/zero +Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE +' | runapt "${METHODSDIR}/gpgv" +} +testrun diff --git a/test/integration/test-srcrecord b/test/integration/test-srcrecord new file mode 100755 index 000000000..34de2be72 --- /dev/null +++ b/test/integration/test-srcrecord @@ -0,0 +1,35 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'native' + +cat > aptarchive/Sources <<EOF +Package: space-before-comma +Binary: space-before-comma1 , space-before-comma2 +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: all + +Package: broken-field +Binary:, broken-field2 +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: all + +Package: broken-field-b +Binary: , broken-field-b2 +Version: 1.0 +Maintainer: Joe Sixpack <joe@example.org> +Architecture: all +EOF + +setupaptarchive --no-update + +testsuccess aptget update +testsuccess aptcache showsrc space-before-comma1 +testsuccess aptcache showsrc broken-field2 +testsuccess aptcache showsrc broken-field-b2 diff --git a/test/libapt/CMakeLists.txt b/test/libapt/CMakeLists.txt index 7f9990526..f3df14848 100644 --- a/test/libapt/CMakeLists.txt +++ b/test/libapt/CMakeLists.txt @@ -1,22 +1,33 @@ -include(ExternalProject) - set(GTEST_ROOT "/usr/src/gtest" CACHE FILEPATH "Path to GTest CMake project") -message(STATUS "Found GTest at ${GTEST_ROOT}") +find_package(GTest) +set(GTEST_DEPENDENCIES) + +if(NOT GTEST_FOUND AND EXISTS ${GTEST_ROOT}) + include(ExternalProject) + ExternalProject_Add(gtest PREFIX ./gtest + SOURCE_DIR ${GTEST_ROOT} + INSTALL_COMMAND true) -if (EXISTS ${GTEST_ROOT}) + link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build) -ExternalProject_Add(gtest PREFIX ./gtest - SOURCE_DIR ${GTEST_ROOT} - INSTALL_COMMAND true) + set(GTEST_LIBRARIES "-lgtest") + set(GTEST_DEPENDENCIES "gtest") + set(GTEST_FOUND TRUE) + find_path(GTEST_INCLUDE_DIRS NAMES gtest/gtest.h) -link_directories(${CMAKE_CURRENT_BINARY_DIR}/gtest/src/gtest-build) -FILE(GLOB files gtest_runner.cc *-helpers.cc *_test.cc) -add_executable(libapt_test ${files}) -target_link_libraries(libapt_test -lgtest ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst) -add_dependencies(libapt_test gtest) -add_test(NAME AptTests - COMMAND libapt_test - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + message(STATUS "Found GTest at ${GTEST_ROOT}, headers at ${GTEST_INCLUDE_DIRS}") +endif() +if(GTEST_FOUND) + file(GLOB files gtest_runner.cc *-helpers.cc *_test.cc) + add_executable(libapt_test ${files}) + target_include_directories(libapt_test PRIVATE ${GTEST_INCLUDE_DIRS}) + target_link_libraries(libapt_test ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} apt-private apt-inst) + if (GTEST_DEPENDENCIES) + add_dependencies(libapt_test ${GTEST_DEPENDENCIES}) + endif() + add_test(NAME AptTests + COMMAND libapt_test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc index 7783c47a4..97725c854 100644 --- a/test/libapt/commandline_test.cc +++ b/test/libapt/commandline_test.cc @@ -17,10 +17,6 @@ class CLT: public CommandLine { } }; -bool ShowHelp(CommandLine &) {return false;} -std::vector<aptDispatchWithHelp> GetCommands() {return {};} - - TEST(CommandLineTest,SaveInConfig) { #define APT_EXPECT_CMD(x, ...) { const char * const argv[] = { __VA_ARGS__ }; EXPECT_EQ(x, CLT::AsString(argv, sizeof(argv)/sizeof(argv[0]))); } @@ -166,7 +162,7 @@ TEST(CommandLineTest, BoolParsing) } -bool DoVoid(CommandLine &) { return false; } +static bool DoVoid(CommandLine &) { return false; } TEST(CommandLineTest,GetCommand) { diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index 90a5817ad..d7700bd54 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -168,7 +168,7 @@ TEST(StrUtilTest,Base64Encode) EXPECT_EQ("Lg==", Base64Encode(".")); EXPECT_EQ("", Base64Encode("")); } -void ReadMessagesTestWithNewLine(char const * const nl, char const * const ab) +static void ReadMessagesTestWithNewLine(char const * const nl, char const * const ab) { SCOPED_TRACE(SubstVar(SubstVar(nl, "\n", "n"), "\r", "r") + " # " + ab); FileFd fd; diff --git a/test/libapt/tagsection_test.cc b/test/libapt/tagsection_test.cc index f250177af..779932595 100644 --- a/test/libapt/tagsection_test.cc +++ b/test/libapt/tagsection_test.cc @@ -24,7 +24,7 @@ std::string overrideValue = "1"; std::cerr << "«" << std::endl;; */ -void setupTestcaseStart(FileFd &fd, pkgTagSection §ion, std::string &content) +static void setupTestcaseStart(FileFd &fd, pkgTagSection §ion, std::string &content) { createTemporaryFile("writesection", fd, NULL, NULL); content = "Package: " + packageValue + "\n" |