Explorar el Código

don't count each Type as an individual deb822-sources stanza

Reported-By: Mattia Rizzolo <mattia@debian.org> in #834629
David Kalnischkies hace 10 años
padre
commit
1485040e1b
Se han modificado 1 ficheros con 3 adiciones y 5 borrados
  1. 3 5
      apt-pkg/sourcelist.cc

+ 3 - 5
apt-pkg/sourcelist.cc

@@ -423,18 +423,18 @@ bool pkgSourceList::ParseFileOldStyle(std::string const &File)
 /* Returns: the number of stanzas parsed*/
 /* Returns: the number of stanzas parsed*/
 bool pkgSourceList::ParseFileDeb822(string const &File)
 bool pkgSourceList::ParseFileDeb822(string const &File)
 {
 {
-   unsigned int i = 1;
-
    // see if we can read the file
    // see if we can read the file
    FileFd Fd(File, FileFd::ReadOnly);
    FileFd Fd(File, FileFd::ReadOnly);
    pkgTagFile Sources(&Fd, pkgTagFile::SUPPORT_COMMENTS);
    pkgTagFile Sources(&Fd, pkgTagFile::SUPPORT_COMMENTS);
    if (Fd.IsOpen() == false || Fd.Failed())
    if (Fd.IsOpen() == false || Fd.Failed())
-      return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
+      return _error->Error(_("Malformed stanza %u in source list %s (type)"),0,File.c_str());
 
 
    // read step by step
    // read step by step
    pkgTagSection Tags;
    pkgTagSection Tags;
+   unsigned int i = 0;
    while (Sources.Step(Tags) == true)
    while (Sources.Step(Tags) == true)
    {
    {
+      ++i;
       if(Tags.Exists("Types") == false)
       if(Tags.Exists("Types") == false)
 	 return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
 	 return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
 
 
@@ -452,8 +452,6 @@ bool pkgSourceList::ParseFileDeb822(string const &File)
 
 
          if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
          if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
             return false;
             return false;
-
-         ++i;
       }
       }
    }
    }
    return true;
    return true;