* apt-pkg/contrib/configuration.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 30 Jan 2012 12:13:29 +0000 (13:13 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 30 Jan 2012 12:13:29 +0000 (13:13 +0100)
  - do not stop parent transversal in FindDir if the value is empty

See http://lists.debian.org/deity/2012/01/msg00053.html , too.

apt-pkg/contrib/configuration.cc
debian/changelog
test/libapt/configuration_test.cc

index 0949ec2..36866a3 100644 (file)
@@ -185,8 +185,14 @@ string Configuration::FindFile(const char *Name,const char *Default) const
    }
    
    string val = Itm->Value;
-   while (Itm->Parent != 0 && Itm->Parent->Value.empty() == false)
-   {    
+   while (Itm->Parent != 0)
+   {
+      if (Itm->Parent->Value.empty() == true)
+      {
+        Itm = Itm->Parent;
+        continue;
+      }
+
       // Absolute
       if (val.length() >= 1 && val[0] == '/')
          break;
index f1ccaf4..12abea4 100644 (file)
@@ -7,6 +7,8 @@ apt (0.8.16~exp13) UNRELEASED; urgency=low
   * apt-pkg/depcache.cc:
     - if a M-A:same package is marked for reinstall, mark all it's installed
       silbings for reinstallation as well (LP: #859188)
+  * apt-pkg/contrib/configuration.cc:
+    - do not stop parent transversal in FindDir if the value is empty
 
   [ Steve Langasek ]
   * cmdline/apt-get.cc:
@@ -20,7 +22,7 @@ apt (0.8.16~exp13) UNRELEASED; urgency=low
     - use a signed int instead of short for score calculation as upgrades
       become so big now that it can overflow (Closes: #657732, LP: #917173)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 29 Jan 2012 15:22:50 +0100
+ -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 30 Jan 2012 13:07:30 +0100
 
 apt (0.8.16~exp12) experimental; urgency=low
 
index 5b23d17..9a3e2c1 100644 (file)
@@ -71,6 +71,15 @@ int main(int argc,const char *argv[]) {
        equals(Cnf.Find("APT2::Version", "33"), "33");
        equals(Cnf.FindI("APT2::Version", 33), 33);
 
+       equals(Cnf.FindFile("Dir::State"), "");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "");
+       Cnf.Set("Dir", "/srv/sid");
+       equals(Cnf.FindFile("Dir::State"), "");
+       Cnf.Set("Dir::State", "var/lib/apt");
+       Cnf.Set("Dir::Aptitude::State", "var/lib/aptitude");
+       equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude");
+
        //FIXME: Test for configuration file parsing;
        // currently only integration/ tests test them implicitly