From 44edc41ea7146be02775a3af05e91fc56faae3e9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 13 Sep 2011 16:19:09 +0200 Subject: * apt-pkg/contrib/configuration.cc: - fix double delete (LP: #848907) - ignore only the invalid regexp instead of all options --- apt-pkg/contrib/configuration.cc | 9 +++++---- debian/changelog | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 942ea9fbc..2d1dee22d 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -870,10 +870,10 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config) { regfree(p); delete p; - clearPatterns(); - _error->Warning("Regex compilation error for '%s' in configuration option '%s'", - s->c_str(), Config); - return; + _error->Warning("Invalid regular expression '%s' in configuration " + "option '%s' will be ignored.", + s->c_str(), Config); + continue; } } if (strings.size() == 0) @@ -894,6 +894,7 @@ void Configuration::MatchAgainstConfig::clearPatterns() regfree(*p); delete *p; } + patterns.clear(); } /*}}}*/ // MatchAgainstConfig::Match - returns true if a pattern matches /*{{{*/ diff --git a/debian/changelog b/debian/changelog index 3d9bdb31f..8ba89aed6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,9 @@ apt (0.8.16~exp5) experimental; urgency=low * methods/mirror.cc: - include the architecture(s) in the query string as well so that the server can make better decisions + * apt-pkg/contrib/configuration.cc: + - fix double delete (LP: #848907) + - ignore only the invalid regexp instead of all options -- Michael Vogt Fri, 05 Aug 2011 10:57:08 +0200 -- cgit v1.2.3 From b36597e050beaca71a481590c3d287ac706f4309 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 16 Sep 2011 09:15:17 +0200 Subject: * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc: - fix fetching language information by adding OptionalSubIndexTarget --- apt-pkg/acquire-item.h | 8 ++++++++ apt-pkg/deb/debmetaindex.cc | 2 +- debian/changelog | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 13be17a01..6c8341b62 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -691,6 +691,14 @@ class OptionalIndexTarget : public IndexTarget /*}}}*/ /** \brief Information about an subindex index file. */ /*{{{*/ class SubIndexTarget : public IndexTarget +{ + virtual bool IsSubIndex() const { + return true; + } +}; + /*}}}*/ +/** \brief Information about an subindex index file. */ /*{{{*/ +class OptionalSubIndexTarget : public OptionalIndexTarget { virtual bool IsSubIndex() const { return true; diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 81afb22b6..8cbf42579 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -221,7 +221,7 @@ vector * debReleaseIndex::ComputeIndexTargets() const { } else { for (std::set::const_iterator s = sections.begin(); s != sections.end(); ++s) { - IndexTarget * Target = new OptionalIndexTarget(); + IndexTarget * Target = new OptionalSubIndexTarget(); Target->ShortDesc = "TranslationIndex"; Target->MetaKey = TranslationIndexURISuffix("Index", *s); Target->URI = TranslationIndexURI("Index", *s); diff --git a/debian/changelog b/debian/changelog index 8ba89aed6..4fe2cc4a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ apt (0.8.16~exp5) experimental; urgency=low * apt-pkg/contrib/configuration.cc: - fix double delete (LP: #848907) - ignore only the invalid regexp instead of all options + * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc: + - fix fetching language information by adding OptionalSubIndexTarget -- Michael Vogt Fri, 05 Aug 2011 10:57:08 +0200 -- cgit v1.2.3 From db1f14695ce3e5e49e05f67f3ae2225b6706ec66 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 20 Sep 2011 18:21:21 +0200 Subject: * methods/https.cc: - cleanup broken downloads properly --- debian/changelog | 2 ++ methods/https.cc | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 4fe2cc4a6..1665d616e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,8 @@ apt (0.8.16~exp5) experimental; urgency=low - ignore only the invalid regexp instead of all options * apt-pkg/acquire-item.h, apt-pkg/deb/debmetaindex.cc: - fix fetching language information by adding OptionalSubIndexTarget + * methods/https.cc: + - cleanup broken downloads properly -- Michael Vogt Fri, 05 Aug 2011 10:57:08 +0200 diff --git a/methods/https.cc b/methods/https.cc index fc649d6c2..668a329e6 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -270,14 +270,17 @@ bool HttpsMethod::Fetch(FetchItem *Itm) long curl_servdate; curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate); + File->Close(); + // cleanup if(success != 0) { _error->Error("%s", curl_errorstr); + // unlink, no need keep 401/404 page content in partial/ + unlink(File->Name().c_str()); Fail(); return true; } - File->Close(); // Timestamp struct utimbuf UBuf; -- cgit v1.2.3 From a52d11fbc14f8fb10deb93a5898f53a633acbec1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Sep 2011 14:17:13 +0200 Subject: * ftparchive/cachedb.cc: - fix buffersize in bytes2hex --- debian/changelog | 5 +++++ ftparchive/cachedb.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1665d616e..51d09d28a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ apt (0.8.16~exp5) experimental; urgency=low + [ Michael Vogt ] * apt-pkg/makefile: - install sha256.h compat header * apt-pkg/pkgcachegen.{cc,h}: @@ -22,6 +23,10 @@ apt (0.8.16~exp5) experimental; urgency=low - fix fetching language information by adding OptionalSubIndexTarget * methods/https.cc: - cleanup broken downloads properly + + [ Colin Watson ] + * ftparchive/cachedb.cc: + - fix buffersize in bytes2hex -- Michael Vogt Fri, 05 Aug 2011 10:57:08 +0200 diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index 7e4c2e9fe..080c2bbcc 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -297,7 +297,7 @@ bool CacheDB::LoadContents(bool const &GenOnly) /*}}}*/ static string bytes2hex(uint8_t *bytes, size_t length) { - char space[65]; + char space[129]; if (length * 2 > sizeof(space) - 1) length = (sizeof(space) - 1) / 2; for (size_t i = 0; i < length; i++) snprintf(&space[i*2], 3, "%02x", bytes[i]); -- cgit v1.2.3 From 76ef756a6babf9fa217bed2f7618cb00140b4306 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Sep 2011 15:15:30 +0200 Subject: ftparchive/cachedb.cc: rewrite to fix the fixed length field --- ftparchive/cachedb.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ftparchive/cachedb.cc b/ftparchive/cachedb.cc index 080c2bbcc..24e3a1af8 100644 --- a/ftparchive/cachedb.cc +++ b/ftparchive/cachedb.cc @@ -297,11 +297,15 @@ bool CacheDB::LoadContents(bool const &GenOnly) /*}}}*/ static string bytes2hex(uint8_t *bytes, size_t length) { - char space[129]; - if (length * 2 > sizeof(space) - 1) length = (sizeof(space) - 1) / 2; - for (size_t i = 0; i < length; i++) - snprintf(&space[i*2], 3, "%02x", bytes[i]); - return string(space); + char buf[3]; + string space; + + space.reserve(length*2 + 1); + for (size_t i = 0; i < length; i++) { + snprintf(buf, sizeof(buf), "%02x", bytes[i]); + space.append(buf); + } + return space; } static inline unsigned char xdig2num(char const &dig) { -- cgit v1.2.3 From a865ed25fa54514224cf4d6f83dd9cf48b7ed02b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 26 Sep 2011 13:30:19 +0200 Subject: merged fix from donkult --- apt-pkg/deb/deblistparser.cc | 32 ++++++++++++++++++++------------ debian/changelog | 5 +++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 59c4ee365..e4f3f9582 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -816,16 +816,16 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, ++lineEnd; // which datastorage need to be updated - map_ptrloc* writeTo = NULL; + enum { Suite, Component, Version, Origin, Codename, Label, None } writeTo = None; if (buffer[0] == ' ') ; - #define APT_PARSER_WRITETO(X, Y) else if (strncmp(Y, buffer, len) == 0) writeTo = &X; - APT_PARSER_WRITETO(FileI->Archive, "Suite") - APT_PARSER_WRITETO(FileI->Component, "Component") - APT_PARSER_WRITETO(FileI->Version, "Version") - APT_PARSER_WRITETO(FileI->Origin, "Origin") - APT_PARSER_WRITETO(FileI->Codename, "Codename") - APT_PARSER_WRITETO(FileI->Label, "Label") + #define APT_PARSER_WRITETO(X) else if (strncmp(#X, buffer, len) == 0) writeTo = X; + APT_PARSER_WRITETO(Suite) + APT_PARSER_WRITETO(Component) + APT_PARSER_WRITETO(Version) + APT_PARSER_WRITETO(Origin) + APT_PARSER_WRITETO(Codename) + APT_PARSER_WRITETO(Label) #undef APT_PARSER_WRITETO #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \ pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd); @@ -835,19 +835,19 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, // load all data from the line and save it string data; - if (writeTo != NULL) + if (writeTo != None) data.append(dataStart, dataEnd); if (sizeof(buffer) - 1 == (dataEnd - buffer)) { while (fgets(buffer, sizeof(buffer), release) != NULL) { - if (writeTo != NULL) + if (writeTo != None) data.append(buffer); if (strlen(buffer) != sizeof(buffer) - 1) break; } } - if (writeTo != NULL) + if (writeTo != None) { // remove spaces and stuff from the end of the data line for (std::string::reverse_iterator s = data.rbegin(); @@ -857,7 +857,15 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, break; *s = '\0'; } - *writeTo = WriteUniqString(data); + switch (writeTo) { + case Suite: FileI->Archive = WriteUniqString(data); break; + case Component: FileI->Component = WriteUniqString(data); break; + case Version: FileI->Version = WriteUniqString(data); break; + case Origin: FileI->Origin = WriteUniqString(data); break; + case Codename: FileI->Codename = WriteUniqString(data); break; + case Label: FileI->Label = WriteUniqString(data); break; + case None: break; + } } } fclose(release); diff --git a/debian/changelog b/debian/changelog index 51d09d28a..4ca81c329 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,6 +28,11 @@ apt (0.8.16~exp5) experimental; urgency=low * ftparchive/cachedb.cc: - fix buffersize in bytes2hex + [ David Kalnischkies ] + * apt-pkg/deb/deblistparser.cc: + - fix crash when the dynamic mmap needs to be grown in + LoadReleaseInfo (LP: #854090) + -- Michael Vogt Fri, 05 Aug 2011 10:57:08 +0200 apt (0.8.16~exp4) experimental; urgency=low -- cgit v1.2.3