]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/contrib/configuration.cc:
authorMichael Vogt <michael.vogt@ubuntu.com>
Wed, 5 Oct 2011 16:14:38 +0000 (18:14 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Wed, 5 Oct 2011 16:14:38 +0000 (18:14 +0200)
  - 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

* ftparchive/cachedb.cc:
  - fix buffersize in bytes2hex
* apt-pkg/deb/deblistparser.cc:
  - fix crash when the dynamic mmap needs to be grown in
    LoadReleaseInfo (LP: #854090)

1  2 
apt-pkg/contrib/configuration.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/debmetaindex.cc
debian/changelog
ftparchive/cachedb.cc
methods/https.cc

index 0f7b37ee9964d0592b09806da07fdf50a44fc5d3,2d1dee22d19668ed90b4f67e9d7136580a074ba1..0949ec2238752bde6f399c463ea61b663c75ecfc
     ##################################################################### */
                                                                        /*}}}*/
  // Include files                                                      /*{{{*/
 +#include <config.h>
 +
  #include <apt-pkg/configuration.h>
  #include <apt-pkg/error.h>
  #include <apt-pkg/strutl.h>
  #include <apt-pkg/fileutl.h>
 -#include <apti18n.h>
  
  #include <vector>
  #include <fstream>
  #include <iostream>
  
 +#include <apti18n.h>
 +
  using namespace std;
                                                                        /*}}}*/
  
@@@ -675,9 -672,9 +675,9 @@@ bool ReadConfigFile(Configuration &Conf
            // Put the last fragment into the buffer
            std::string::const_iterator NonWhitespaceStart = Start;
            std::string::const_iterator NonWhitespaceStop = I;
 -          for (; NonWhitespaceStart != I && isspace(*NonWhitespaceStart) != 0; NonWhitespaceStart++)
 +          for (; NonWhitespaceStart != I && isspace(*NonWhitespaceStart) != 0; ++NonWhitespaceStart)
              ;
 -          for (; NonWhitespaceStop != NonWhitespaceStart && isspace(NonWhitespaceStop[-1]) != 0; NonWhitespaceStop--)
 +          for (; NonWhitespaceStop != NonWhitespaceStart && isspace(NonWhitespaceStop[-1]) != 0; --NonWhitespaceStop)
              ;
            if (LineBuffer.empty() == false && NonWhitespaceStop - NonWhitespaceStart != 0)
               LineBuffer += ' ';
@@@ -853,7 -850,7 +853,7 @@@ bool ReadConfigDir(Configuration &Conf,
     vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);
  
     // Read the files
 -   for (vector<string>::const_iterator I = List.begin(); I != List.end(); I++)
 +   for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
        if (ReadConfigFile(Conf,*I,AsSectional,Depth) == false)
         return false;
     return true;
@@@ -873,10 -870,10 +873,10 @@@ Configuration::MatchAgainstConfig::Matc
        {
         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)
@@@ -897,6 -894,7 +897,7 @@@ void Configuration::MatchAgainstConfig:
        regfree(*p);
        delete *p;
     }
+    patterns.clear();
  }
                                                                        /*}}}*/
  // MatchAgainstConfig::Match - returns true if a pattern matches      /*{{{*/
index a4a974897f94d64611be4a71b87affbfd4eabbf8,e4f3f95826baadabe7609fa6ca07af03d8f7b95b..6c8bc838bdc60f064c381ee75ac720fd65a8176b
@@@ -10,8 -10,6 +10,8 @@@
     ##################################################################### */
                                                                        /*}}}*/
  // Include Files                                                      /*{{{*/
 +#include <config.h>
 +
  #include <apt-pkg/deblistparser.h>
  #include <apt-pkg/error.h>
  #include <apt-pkg/configuration.h>
@@@ -200,7 -198,7 +200,7 @@@ string debListParser::DescriptionLangua
  
     std::vector<string> const lang = APT::Configuration::getLanguages(true);
     for (std::vector<string>::const_iterator l = lang.begin();
 -      l != lang.end(); l++)
 +      l != lang.end(); ++l)
        if (Section.FindS(string("Description-").append(*l).c_str()).empty() == false)
         return *l;
  
@@@ -818,16 -816,16 +818,16 @@@ bool debListParser::LoadReleaseInfo(pkg
        ++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);
  
        // 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();
               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);
index 1d3754b0054b5add45b76a782df0fef77ee72ee3,8cbf4257993ffa3a8165761d1f6498767bd3f84c..f24e3afef4555699879a31bfdcc4a71df1ced450
@@@ -1,5 -1,4 +1,5 @@@
  // ijones, walters
 +#include <config.h>
  
  #include <apt-pkg/debmetaindex.h>
  #include <apt-pkg/debindexfile.h>
@@@ -209,7 -208,7 +209,7 @@@ vector <struct IndexTarget *>* debRelea
                for (std::set<std::string>::const_iterator s = sections.begin();
                     s != sections.end(); ++s) {
                        for (std::vector<std::string>::const_iterator l = lang.begin();
 -                           l != lang.end(); l++) {
 +                           l != lang.end(); ++l) {
                                if (*l == "none") continue;
                                IndexTarget * Target = new OptionalIndexTarget();
                                Target->ShortDesc = "Translation-" + *l;
        } else {
                for (std::set<std::string>::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);
@@@ -239,7 -238,7 +239,7 @@@ bool debReleaseIndex::GetIndexes(pkgAcq
     // special case for --print-uris
     if (GetAll) {
        vector <struct IndexTarget *> *targets = ComputeIndexTargets();
 -      for (vector <struct IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); Target++) {
 +      for (vector <struct IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); ++Target) {
         new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description,
                         (*Target)->ShortDesc, HashString());
        }
@@@ -296,7 -295,7 +296,7 @@@ vector <pkgIndexFile *> *debReleaseInde
        if (src != ArchEntries.end()) {
                vector<debSectionEntry const*> const SectionEntries = src->second;
                for (vector<debSectionEntry const*>::const_iterator I = SectionEntries.begin();
 -                   I != SectionEntries.end(); I++)
 +                   I != SectionEntries.end(); ++I)
                        Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted()));
        }
  
                if (a->first == "source")
                        continue;
                for (vector<debSectionEntry const*>::const_iterator I = a->second.begin();
 -                   I != a->second.end(); I++) {
 +                   I != a->second.end(); ++I) {
                        Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted(), a->first));
                        sections[(*I)->Section].insert(lang.begin(), lang.end());
                }
        for (map<string, set<string> >::const_iterator s = sections.begin();
             s != sections.end(); ++s)
                for (set<string>::const_iterator l = s->second.begin();
 -                   l != s->second.end(); l++) {
 +                   l != s->second.end(); ++l) {
                        if (*l == "none") continue;
                        Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str()));
                }
@@@ -369,7 -368,7 +369,7 @@@ class debSLTypeDebian : public pkgSourc
        map<string, string>::const_iterator const trusted = Options.find("trusted");
  
        for (vector<metaIndex *>::const_iterator I = List.begin();
 -         I != List.end(); I++)
 +         I != List.end(); ++I)
        {
         // We only worry about debian entries here
         if (strcmp((*I)->GetType(), "deb") != 0)
diff --combined debian/changelog
index 7e1ce4f4ea7775e43cb2e12a8b5be7e84289a1f7,4ca81c32902152b4712da899e0e0967e63febf7e..a06abbbc08dfcb8864107da9584b8d562354b5b2
@@@ -1,42 -1,39 +1,64 @@@
 -apt (0.8.16~exp5) experimental; urgency=low
++apt (0.8.16~exp7) UNRELEASEDexperimental; urgency=low
+   [ Michael Vogt ]
 -  * apt-pkg/makefile:
 -    - install sha256.h compat header
 -  * apt-pkg/pkgcachegen.{cc,h}:
 -    - use ref-to-ptr semantic in NewDepends() to ensure that the   
 -      libapt does not segfault if the cache is remapped in between
 -      (LP: #812862)
 -    - fix crash when P.Arch() was used but the cache got remapped
 -  * apt-pkg/acquire-item.{cc,h}:
 -    - do not check for a "Package" tag in optional index targets
 -      like the translations index
 -  * apt-pkg/acquire.cc:
 -    - fix potential divide-by-zero
 -  * 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
+   * 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 ]  
+   * apt-pkg/deb/deblistparser.cc:
+     - fix crash when the dynamic mmap needs to be grown in
+       LoadReleaseInfo (LP: #854090)
 - -- Michael Vogt <mvo@debian.org>  Fri, 05 Aug 2011 10:57:08 +0200
++ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 05 Oct 2011 18:14:11 +0200
++
 +apt (0.8.16~exp6) experimental; urgency=low
 +
 +  [ Christopher Baines ]
 +  * enable APT in unpack/configure ordering to handle loops as well
 +    as tight dependencies between immediate packages better
 +    enabling also the possibility to mark all packages as immediate
 +    (at least Closes: #353290, #540227, #559733, #621836, #639290)
 +
 +  [ David Kalnischkies ]
 +  * [abi-break] Support large files in the complete toolset. Indexes of this
 +    size are pretty unlikely for now, but we need it for deb
 +    packages which could become bigger than 4GB now (LP: #815895)
 +  * merged the debian-sid branch
 +  
 +  [ Michael Vogt ]
 +  * bump ABI version
 +
 + -- Michael Vogt <mvo@debian.org>  Wed, 14 Sep 2011 21:06:51 +0200
 +
 +apt (0.8.16~exp5) experimental; urgency=low
 +
 +  * merged the latest debian-sid fixes
 +  * apt-pkg/makefile:
 +    - install sha256.h compat header
 +  * apt-pkg/pkgcachegen.{cc,h}:
 +    - use ref-to-ptr semantic in NewDepends() to ensure that the   
 +      libapt does not segfault if the cache is remapped in between
 +      (LP: #812862)
 +    - fix crash when P.Arch() was used but the cache got remapped
 +  * apt-pkg/acquire-item.{cc,h}:
 +    - do not check for a "Package" tag in optional index targets
 +      like the translations index
 +  * apt-pkg/acquire.cc:
 +    - fix potential divide-by-zero
 +  * methods/mirror.cc:
 +    - include the architecture(s) in the query string as well so 
 +      that the server can make better decisions
 +
 + -- Michael Vogt <mvo@debian.org>  Mon, 15 Aug 2011 14:52:54 +0200
  
  apt (0.8.16~exp4) experimental; urgency=low
  
@@@ -134,51 -131,8 +156,51 @@@ apt (0.8.16~exp1) experimental; urgency
  
   -- Michael Vogt <mvo@debian.org>  Wed, 29 Jun 2011 12:40:31 +0200
  
 -apt (0.8.15.5.6) UNRELEASED; urgency=low
 +apt (0.8.15.7) unstable; urgency=low
 +
 +  [ David Kalnischkies ]
 +  * apt-pkg/packagemanager.cc, apt-pkg/pkgcache.cc:
 +    - ignore "self"-conflicts for all architectures of a package
 +      instead of just for the architecture of the package look at
 +      in the ordering of installations, too (LP: #802901)
 +    - M-A:same lockstep unpack should operate on installed
 +      packages first (LP: #835625)
 +  * test/*
 +    - reorganize the various testcases and helper we have and
 +      integrate them better into the buildsystem
 +    - run the test/libapt testcases at package build-time
 +  * debian/apt.symbols:
 +    - add the newly added symbols since 0.8.15.3
 +  * cmdline/apt-get.cc:
 +    - remove the binary caches in 'apt-get clean' as it is the first
 +      thing recommend by many supporters in case of APT segfaults
 +    - remove the caches in 'apt-get update', too, as they will be
 +      invalid in most cases anyway
 +  * apt-pkg/acquire-item.cc:
 +    - if no Release.gpg file is found try to verify with hashes,
 +      but do not fail if a hash can't be found
 +  * apt-pkg/acquire.cc:
 +    - non-existing directories are by definition clean
 +  * cmdline/apt-key:
 +    - if command is 'add' do not error out if the specified
 +      keyring doesn't exist, it will be created by gpg
 +  * apt-pkg/orderlist.cc:
 +    - prefer visiting packages marked for deletion in VisitProvides
 +      if we are operating on a negative dependency so that we can
 +      deal early with the fallout of this remove
 +  * apt-pkg/indexrecords.cc:
 +    - fix Acquire::Max-ValidTime option by interpreting it really
 +      as seconds as specified in the manpage and not as days
 +    - add an Acquire::Min-ValidTime option (Closes: #640122)
 +  * doc/apt.conf.5.xml:
 +    - reword Acquire::Max-ValidTime documentation to make clear
 +      that it doesn't provide the new Min-ValidTime functionality
 +
 + -- Michael Vogt <mvo@debian.org>  Mon, 12 Sep 2011 16:38:46 +0200
 +
 +apt (0.8.15.6) unstable; urgency=low
  
 +  [ Michael Vogt ]
    * apt-pkg/contrib/fileutl.{cc,h}:
      - add GetModificationTime() helper
    * apt-pkg/pkgcachegen.cc:
    * apt-pkg/acquire-item.cc:
      - if no Release.gpg file is found, still load the hashes for
        verification (closes: #636314) and add test
 +  
 +  [ David Kalnischkies ]
 +  * lots of cppcheck fixes
  
 - -- Michael Vogt <mvo@debian.org>  Tue, 12 Jul 2011 11:54:47 +0200
 + -- Michael Vogt <mvo@debian.org>  Mon, 15 Aug 2011 09:20:35 +0200
  
  apt (0.8.15.5) unstable; urgency=low
  
diff --combined ftparchive/cachedb.cc
index a1d70f912f8020c1ffebf62b2094028d530d93a0,24e3a1af864d66f6dcc265b2ec1ef066d0fc980f..6eccb8d4ae6f8f046e49bc5f30c85a99f230e0a9
@@@ -10,8 -10,9 +10,8 @@@
     ##################################################################### */
                                                                        /*}}}*/
  // Include Files                                                      /*{{{*/
 -#include "cachedb.h"
 +#include <config.h>
  
 -#include <apti18n.h>
  #include <apt-pkg/error.h>
  #include <apt-pkg/md5.h>
  #include <apt-pkg/sha1.h>
@@@ -20,9 -21,6 +20,9 @@@
  #include <apt-pkg/configuration.h>
      
  #include <netinet/in.h>       // htonl, etc
 +
 +#include <apti18n.h>
 +#include "cachedb.h"
                                                                        /*}}}*/
  
  // CacheDB::ReadyDB - Ready the DB2                                   /*{{{*/
@@@ -299,11 -297,15 +299,15 @@@ bool CacheDB::LoadContents(bool const &
                                                                        /*}}}*/
  
  static 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 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) {
diff --combined methods/https.cc
index 06a0e285aa2d5cbb594ea007ef043277288ef38a,668a329e6ba12a8baca3fbd7247181da9457d4d8..709744ce335a7664c745e15e141e58aa737ff751
@@@ -10,8 -10,6 +10,8 @@@
     ##################################################################### */
                                                                        /*}}}*/
  // Include Files                                                      /*{{{*/
 +#include <config.h>
 +
  #include <apt-pkg/fileutl.h>
  #include <apt-pkg/acquire-method.h>
  #include <apt-pkg/error.h>
  #include <errno.h>
  #include <string.h>
  #include <iostream>
 -#include <apti18n.h>
  #include <sstream>
  
  #include "config.h"
  #include "https.h"
 -
 +#include <apti18n.h>
                                                                        /*}}}*/
  using namespace std;
  
@@@ -52,7 -51,7 +52,7 @@@ HttpsMethod::progress_callback(void *cl
  {
     HttpsMethod *me = (HttpsMethod *)clientp;
     if(dltotal > 0 && me->Res.Size == 0) {
 -      me->Res.Size = (unsigned long)dltotal;
 +      me->Res.Size = (unsigned long long)dltotal;
        me->URIStart(me->Res);
     }
     return 0;
@@@ -271,14 -270,17 +271,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;