- Fix repo_content dependency parsing. Parser may lose up to
authorMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 14:35:30 +0000 (14:35 +0000)
committerMichael Andres <ma@suse.de>
Wed, 9 Jul 2008 14:35:30 +0000 (14:35 +0000)
  two trailing dependencies.

package/libsatsolver.changes
tools/repo_content.c

index 02e93f8..0883880 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Wed Jul  9 16:25:36 CEST 2008 - ma@suse.de
+
+- Fix repo_content dependency parsing. Parser may lose up to 
+  two trailing dependencies.
+
+-------------------------------------------------------------------
 Tue Jul  1 14:54:38 CEST 2008 - kkaempf@suse.de
 
 - rename language bindings to {perl,python,ruby}-satsolver
index da7a99c..36ed85f 100644 (file)
@@ -110,8 +110,11 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
   while (1)
     {
       /* Name [relop evr] [rest] --> 1, 2, 3 or 4 fields.  */
-      words += split(line, sp + words, 4 - words);
-      line = 0;
+      if ( line )
+        {
+          words += split(line, sp + words, 4 - words);
+          line = 0;
+        }
       /* Hack, as the content file adds 'package:' for package
          dependencies sometimes.  */
       if (!strncmp (sp[0], "package:", 8))
@@ -131,7 +134,8 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
          id = rel2id(pool, id, evrid, flags + 1, 1);
          /* Consume three words, there's nothing to move to front.  */
          if (words == 4)
-           line = sp[3], words = 0;
+           line = sp[3];
+          words = 0;
        }
       else
         {
@@ -144,7 +148,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, char *line, Id ma
            line = sp[2], words = 2;
        }
       olddeps = repo_addid_dep(pd->repo, olddeps, id, marker);
-      if (!line)
+      if (! ( line || words > 0 ) )
         break;
     }
   return olddeps;