Bladeren bron

merge with current debian apt/experimental

David Kalnischkies 14 jaren geleden
bovenliggende
commit
0fffbc8ce4

+ 8 - 0
apt-pkg/acquire-item.h

@@ -691,6 +691,14 @@ class OptionalIndexTarget : public IndexTarget
 									/*}}}*/
 									/*}}}*/
 /** \brief Information about an subindex index file. */			/*{{{*/
 /** \brief Information about an subindex index file. */			/*{{{*/
 class SubIndexTarget : public IndexTarget
 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 {
    virtual bool IsSubIndex() const {
       return true;
       return true;

+ 5 - 4
apt-pkg/contrib/configuration.cc

@@ -873,10 +873,10 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config)
       {
       {
 	 regfree(p);
 	 regfree(p);
 	 delete 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)
    if (strings.size() == 0)
@@ -897,6 +897,7 @@ void Configuration::MatchAgainstConfig::clearPatterns()
       regfree(*p);
       regfree(*p);
       delete *p;
       delete *p;
    }
    }
+   patterns.clear();
 }
 }
 									/*}}}*/
 									/*}}}*/
 // MatchAgainstConfig::Match - returns true if a pattern matches	/*{{{*/
 // MatchAgainstConfig::Match - returns true if a pattern matches	/*{{{*/

+ 20 - 12
apt-pkg/deb/deblistparser.cc

@@ -821,16 +821,16 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
       ++lineEnd;
       ++lineEnd;
 
 
       // which datastorage need to be updated
       // which datastorage need to be updated
-      map_ptrloc* writeTo = NULL;
+      enum { Suite, Component, Version, Origin, Codename, Label, None } writeTo = None;
       if (buffer[0] == ' ')
       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
       #undef APT_PARSER_WRITETO
       #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
       #define APT_PARSER_FLAGIT(X) else if (strncmp(#X, buffer, len) == 0) \
 	 pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd);
 	 pkgTagSection::FindFlag(FileI->Flags, pkgCache::Flag:: X, dataStart, lineEnd);
@@ -840,19 +840,19 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 
 
       // load all data from the line and save it
       // load all data from the line and save it
       string data;
       string data;
-      if (writeTo != NULL)
+      if (writeTo != None)
 	 data.append(dataStart, dataEnd);
 	 data.append(dataStart, dataEnd);
       if (sizeof(buffer) - 1 == (dataEnd - buffer))
       if (sizeof(buffer) - 1 == (dataEnd - buffer))
       {
       {
 	 while (fgets(buffer, sizeof(buffer), release) != NULL)
 	 while (fgets(buffer, sizeof(buffer), release) != NULL)
 	 {
 	 {
-	    if (writeTo != NULL)
+	    if (writeTo != None)
 	       data.append(buffer);
 	       data.append(buffer);
 	    if (strlen(buffer) != sizeof(buffer) - 1)
 	    if (strlen(buffer) != sizeof(buffer) - 1)
 	       break;
 	       break;
 	 }
 	 }
       }
       }
-      if (writeTo != NULL)
+      if (writeTo != None)
       {
       {
 	 // remove spaces and stuff from the end of the data line
 	 // remove spaces and stuff from the end of the data line
 	 for (std::string::reverse_iterator s = data.rbegin();
 	 for (std::string::reverse_iterator s = data.rbegin();
@@ -862,7 +862,15 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
 	       break;
 	       break;
 	    *s = '\0';
 	    *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);
    fclose(release);

+ 1 - 1
apt-pkg/deb/debmetaindex.cc

@@ -225,7 +225,7 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
 	} else {
 	} else {
 		for (std::set<std::string>::const_iterator s = sections.begin();
 		for (std::set<std::string>::const_iterator s = sections.begin();
 		     s != sections.end(); ++s) {
 		     s != sections.end(); ++s) {
-			IndexTarget * Target = new OptionalIndexTarget();
+			IndexTarget * Target = new OptionalSubIndexTarget();
 			Target->ShortDesc = "TranslationIndex";
 			Target->ShortDesc = "TranslationIndex";
 			Target->MetaKey = TranslationIndexURISuffix("Index", *s);
 			Target->MetaKey = TranslationIndexURISuffix("Index", *s);
 			Target->URI = TranslationIndexURI("Index", *s);
 			Target->URI = TranslationIndexURI("Index", *s);

+ 19 - 2
debian/changelog

@@ -1,4 +1,4 @@
-apt (0.8.16~exp7) experimental; urgency=low
+apt (0.8.16~exp7) UNRELEASEDexperimental; urgency=low
 
 
   [ David Kalnischkies ]
   [ David Kalnischkies ]
   * do not pollute namespace in the headers with using (Closes: #500198)
   * do not pollute namespace in the headers with using (Closes: #500198)
@@ -15,8 +15,25 @@ apt (0.8.16~exp7) experimental; urgency=low
     - if a package is garbage, don't try to save it with FixByInstall
     - if a package is garbage, don't try to save it with FixByInstall
   * apt-pkg/deb/debsrcrecords.cc:
   * apt-pkg/deb/debsrcrecords.cc:
     - remove the limit of 400 Binaries for a source package (Closes: #622110)
     - remove the limit of 400 Binaries for a source package (Closes: #622110)
+  * apt-pkg/deb/deblistparser.cc:
+    - fix crash when the dynamic mmap needs to be grown in
+      LoadReleaseInfo (LP: #854090)
+
+  [ Michael Vogt ]
+  * 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
+  * methods/https.cc:
+    - cleanup broken downloads properly
+
+  [ Colin Watson ]
+  * ftparchive/cachedb.cc:
+    - fix buffersize in bytes2hex
+
 
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 21 Sep 2011 19:29:55 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Wed, 05 Oct 2011 18:40:57 +0200
 
 
 apt (0.8.16~exp6) experimental; urgency=low
 apt (0.8.16~exp6) experimental; urgency=low
 
 

+ 9 - 5
ftparchive/cachedb.cc

@@ -300,11 +300,15 @@ bool CacheDB::LoadContents(bool const &GenOnly)
 									/*}}}*/
 									/*}}}*/
 
 
 static std::string bytes2hex(uint8_t *bytes, size_t length) {
 static std::string bytes2hex(uint8_t *bytes, size_t length) {
-   char space[65];
-   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 std::string(space);
+   char buf[3];
+   std::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) {
 static inline unsigned char xdig2num(char const &dig) {

+ 4 - 1
methods/https.cc

@@ -272,14 +272,17 @@ bool HttpsMethod::Fetch(FetchItem *Itm)
    long curl_servdate;
    long curl_servdate;
    curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate);
    curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate);
 
 
+   File->Close();
+
    // cleanup
    // cleanup
    if(success != 0) 
    if(success != 0) 
    {
    {
       _error->Error("%s", curl_errorstr);
       _error->Error("%s", curl_errorstr);
+      // unlink, no need keep 401/404 page content in partial/
+      unlink(File->Name().c_str());
       Fail();
       Fail();
       return true;
       return true;
    }
    }
-   File->Close();
 
 
    // Timestamp
    // Timestamp
    struct utimbuf UBuf;
    struct utimbuf UBuf;