]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Unbreak code to not end a proof with SOLVER_RULE_RPM_SAME_NAME
authorMichael Schroeder <mls@suse.de>
Wed, 10 Apr 2024 08:40:43 +0000 (10:40 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 10 Apr 2024 08:40:43 +0000 (10:40 +0200)
We broke it with commit f6b47040159e905e62317ef846b26ffcaa8dad8f
when we added the reason to the decisionlist entry but forgot
to adapt the code.

We need to add decisionlist testcases...

src/decision.c

index b73a59e67a65111a6e8e2a3f4da246e373cdc00e..d66edf1beeb686c5895485b2cefd707f552bee88 100644 (file)
@@ -447,17 +447,19 @@ solver_get_proof(Solver *solv, Id id, int flags, Queue *q)
   queue_deleten(q, 0, cnt);
 
   /* switch last two decisions if the unsolvable rule is of type SOLVER_RULE_RPM_SAME_NAME */
-  if (q->count >= 16 && q->elements[q->count - 8 + 3] == SOLVER_RULE_RPM_SAME_NAME && q->elements[q->count - 16] > 0)
+  if (q->count >= 16 && q->elements[q->count - 8 + 4] == SOLVER_RULE_RPM_SAME_NAME && q->elements[q->count - 16] > 0)
     {
-      Rule *r = solv->rules + q->elements[q->count - 8 + 1];
+      Rule *r = solv->rules + q->elements[q->count - 8 + 2];
       /* make sure that the rule is a binary conflict and it matches the installed element */
       if (r->p < 0 && (r->d == 0 || r->d == -1) && r->w2 < 0
-        && (q->elements[q->count - 16] == -r->p || q->elements[q->count - 16] -r->w2))
+        && (q->elements[q->count - 16] == -r->p || q->elements[q->count - 16] == -r->w2))
        {
-         /* looks good! swap decisions and fixup truelit entries */
+         /* looks good! swap decisions and fixup truelit/reason entries */
          move_decision(q, q->count - 16, q->count - 8);
          q->elements[q->count - 16] = -q->elements[q->count - 8];
+         q->elements[q->count - 16 + 1] = SOLVER_REASON_UNIT_RULE;
          q->elements[q->count - 8] = 0;
+         q->elements[q->count - 8 + 1] = SOLVER_REASON_UNSOLVABLE;
        }
     }