Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
c001c75e18
!60 Handle installed packages in three passes and Fix a couple small static analysis findings for uninitialized structs
From: @Lu__Wu 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2024-07-16 09:39:45 +00:00
LuWu
f2e7690e42 libsolv:Handle installed packages in three passes and Fix a couple small static analysis findings for uninitialized structs
Reference:553c69b514
2c4ee52a94
bbd1801748
bbd1801748
Conflict:no
2024-07-16 17:16:57 +08:00
openeuler-ci-bot
50ab507e43
!34 fix memory leak, bindings error, crash error
From: @han_hui_hui 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-10-21 03:30:35 +00:00
han_hui_hui
b502788940 fix memory leak, bindings error, crash error 2022-10-20 11:28:58 +00:00
openeuler-ci-bot
49613951d5
!25 fix testcase read
From: @xing_xing1992 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
2022-03-04 07:57:22 +00:00
weiwei_tiantian
82d7e3ed64 fix testcase read 2022-03-04 11:17:20 +08:00
openeuler-ci-bot
4b422d5f97 !20 backport patches
From: @quanhongfei
Reviewed-by: @anonymous_z
Signed-off-by: @anonymous_z
2021-11-09 08:29:09 +00:00
openeuler-ci-bot
c2b04e1a0c backport patches 2021-11-02 14:56:35 +08:00
openeuler-ci-bot
a4d3c5d53b !14 remove libsolv-help dependency
From: @jianminw
Reviewed-by: @orange-snn
Signed-off-by: @orange-snn,@orange-snn
2021-08-12 11:52:20 +00:00
Jianmin
a6abf4be0c remove libsolv-help dependency 2021-08-03 08:38:50 +00:00
13 changed files with 614 additions and 3 deletions

View File

@ -0,0 +1,31 @@
From 8615575144e6fd3d708a30983ed2415db479ef4c Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 8 Apr 2021 12:17:09 +0200
Subject: [PATCH] Fix: Memory leaks in SWIG generated code (for Python)
There were memory leaks in the `Chksum_from_bin`, `Chksum_add`,
`SolvFp_write` functions wrapper for Python.
The problem was in "freearg" typemap argument defined in "solv.i".
Therefore, the typemap was not applied.
Conflict: NA
Reference: https://github.com/openSUSE/libsolv/commit/8615575144e6fd3d708a30983ed2415db479ef4c
---
bindings/solv.i | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/solv.i b/bindings/solv.i
index 1882b135..3bbeca04 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -63,7 +63,7 @@ typedef struct {
$2 = size;
}
-%typemap(freearg,noblock=1,match="in") (const unsigned char *str, int len) {
+%typemap(freearg,noblock=1,match="in") (const unsigned char *str, size_t len) {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
}

42
Fix-memory-leaks.patch Normal file
View File

@ -0,0 +1,42 @@
From 71c6b26096086926f48d8fced1a03ca52a1eb745 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Mon, 29 Mar 2021 12:46:31 +0200
Subject: [PATCH] Fix memory leaks
Conflict: NA
Reference: https://github.com/openSUSE/libsolv/commit/71c6b26096086926f48d8fced1a03ca52a1eb745
---
ext/repo_deb.c | 1 +
ext/testcase.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ext/repo_deb.c b/ext/repo_deb.c
index 8f637567..34f40fa8 100644
--- a/ext/repo_deb.c
+++ b/ext/repo_deb.c
@@ -792,5 +792,6 @@ pool_deb_get_autoinstalled(Pool *pool, FILE *fp, Queue *q, int flags)
break;
}
}
+ solv_free(buf);
}
diff --git a/ext/testcase.c b/ext/testcase.c
index 8fb6d793..4e9e3154 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -1477,11 +1477,11 @@ testcase_solverresult(Solver *solv, int resultflags)
queue_init(&q);
for (rid = 1; (rclass = solver_ruleclass(solv, rid)) != SOLVER_RULE_UNKNOWN; rid++)
{
- char *prefix = solv_dupjoin("rule ", testcase_rclass2str(rclass), " ");
- prefix = solv_dupappend(prefix, testcase_ruleid(solv, rid), 0);
solver_ruleliterals(solv, rid, &q);
if (rclass == SOLVER_RULE_FEATURE && q.count == 1 && q.elements[0] == -SYSTEMSOLVABLE)
continue;
+ char *prefix = solv_dupjoin("rule ", testcase_rclass2str(rclass), " ");
+ prefix = solv_dupappend(prefix, testcase_ruleid(solv, rid), 0);
for (i = 0; i < q.count; i++)
{
Id p = q.elements[i];

View File

@ -0,0 +1,28 @@
From 0ecd4f310318d9bd91db48e5c9dc7e749fbed82a Mon Sep 17 00:00:00 2001
From: Thomas Lam <79589038+tl-hbk@users.noreply.github.com>
Date: Tue, 30 Mar 2021 05:33:52 -0700
Subject: [PATCH] Fix segfault in resolve_jobrules
In selectandinstall sometimes rules are added and a realloc is required if there's
no more memory available in the allocated block. r-- would just decrement the old
pointer but the realloc could return a completely different block of memory
Conflict: NA
Reference: https://github.com/openSUSE/libsolv/commit/0ecd4f310318d9bd91db48e5c9dc7e749fbed82a
---
src/solver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/solver.c b/src/solver.c
index 9c02cc76..89a2ed10 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1629,6 +1629,7 @@ resolve_jobrules(Solver *solv, int level, int disablerules, Queue *dq)
}
olevel = level;
level = selectandinstall(solv, level, dq, disablerules, i, SOLVER_REASON_RESOLVE_JOB);
+ r = solv->rules + i; /* selectandinstall may have added more rules */
if (level <= olevel)
{
if (level == olevel)

View File

@ -0,0 +1,58 @@
From 2c4ee52a948a9ccff2242cd02ac8ce81a0559deb Mon Sep 17 00:00:00 2001
From: David Cantrell <dcantrell@redhat.com>
Date: Tue, 26 Mar 2024 12:13:55 -0400
Subject: [PATCH] Fix a couple small static analysis findings for uninitialized
structs
The memset() on the KeyValue is more explicit even though if you trace
the code you will see it fills out the struct. However, it's possible
that not every struct member will be initialized and adding the
memset() makes things more obvious and appeases the static analyzer.
The queue_init() appeared to just be missing.
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/2c4ee52a948a9ccff2242cd02ac8ce81a0559deb
---
ext/repo_rpmmd.c | 2 ++
ext/repo_susetags.c | 1 +
ext/testcase.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c
index 1232e4337..5d0f5fe7d 100644
--- a/ext/repo_rpmmd.c
+++ b/ext/repo_rpmmd.c
@@ -609,6 +609,8 @@ fill_cshash_from_new_solvables(struct parsedata *pd)
KeyValue kv;
Repokey *key;
+ memset(&kv, 0, sizeof(kv));
+
for (i = pd->first; i < pool->nsolvables; i++)
{
if (pool->solvables[i].repo != pd->repo)
diff --git a/ext/repo_susetags.c b/ext/repo_susetags.c
index dc60aa49c..544974be5 100644
--- a/ext/repo_susetags.c
+++ b/ext/repo_susetags.c
@@ -339,6 +339,7 @@ lookup_shared_id(Repodata *data, Id p, Id keyname, Id voidid, int uninternalized
if (uninternalized)
{
KeyValue kv;
+ memset(&kv, 0, sizeof(kv));
Repokey *key = repodata_lookup_kv_uninternalized(data, p, keyname, &kv);
if (!key)
return 0;
diff --git a/ext/testcase.c b/ext/testcase.c
index f46f738d3..7b6179b5d 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -1497,6 +1497,7 @@ testcase_solverresult(Solver *solv, int resultflags)
if ((resultflags & TESTCASE_RESULT_USERINSTALLED) != 0)
{
Queue q;
+ queue_init(&q);
solver_get_userinstalled(solv, &q, 0);
for (i = 0; i < q.count; i++)
{

View File

@ -0,0 +1,30 @@
From 9a361f5248557e032f15890aac54c0db53c52098 Mon Sep 17 00:00:00 2001
From: banjiuqingshan <63209634+banjiuqingshan@users.noreply.github.com>
Date: Sun, 19 Jun 2022 01:43:51 +0800
Subject: [PATCH] Fix memory leak when using testsolv to execute cases
*resultp will only keep the pointer of the last cycle, which will lead to memory leakage.
This solves the first memory leak problem in issue #496 "==255147==error..."
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/9a361f5248557e032f15890aac54c0db53c52098
---
ext/testcase.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ext/testcase.c b/ext/testcase.c
index 035cfdbd1..c529057a8 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -2448,7 +2448,10 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
}
}
if (resultp)
+ {
+ solv_free(*resultp);
*resultp = result;
+ }
else
solv_free(result);
if (resultflagsp)

View File

@ -0,0 +1,31 @@
From 2b5e6c28be7dffe1a3b5e90a35c5ee425c08aeb0 Mon Sep 17 00:00:00 2001
From: niner <nine@detonation.org>
Date: Tue, 8 Feb 2022 18:10:54 +0100
Subject: [PATCH] Fix segfault on conflict resolution when using bindings
Solutionelement objects were created with a wrong solutionid (i.e. the
solution element id was used for the solutionid field). This led to invalid
array indexes when trying to read the extraflags which then escalated
into a segfault. Fix by setting solutionid correctly in the Solutionelement
constructor.
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/2b5e6c28be7dffe1a3b5e90a35c5ee425c08aeb0
---
bindings/solv.i | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/solv.i b/bindings/solv.i
index 3a6bac468..1d35bf61b 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -3411,7 +3411,7 @@ returnself(matchsolvable)
e = solv_calloc(1, sizeof(*e));
e->solv = solv;
e->problemid = problemid;
- e->solutionid = id;
+ e->solutionid = solutionid;
e->id = id;
e->type = type;
e->p = p;

View File

@ -0,0 +1,72 @@
From bbd1801748e74259f7d8d7d7eee369064961962b Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Feb 2024 15:25:47 +0100
Subject: [PATCH] Handle installed packages in three passes
Fixes issue #550
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/bbd1801748e74259f7d8d7d7eee369064961962b
---
src/solver.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/solver.c b/src/solver.c
index 741aa1b2f..a1a41f677 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1836,7 +1836,7 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
{
Pool *pool = solv->pool;
Repo *installed = solv->installed;
- int i, n, pass;
+ int i, n, pass, startpass;
int installedpos = solv->installedpos;
Solvable *s;
Id p, pp;
@@ -1845,10 +1845,14 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
POOL_DEBUG(SOLV_DEBUG_SOLVER, "resolving installed packages\n");
if (!installedpos)
installedpos = installed->start;
- /* we use two passes if we need to update packages
- * to create a better user experience */
- for (pass = !solv->updatemap_all && solv->updatemap.size ? 0 : 1; pass < 2; )
+ /* we use passes if we need to update packages to create a better user experience:
+ * pass 0: update the packages requested by the user
+ * pass 1: keep the installed packages if we can
+ * pass 2: update the packages that could not be kept */
+ startpass = solv->updatemap_all ? 2 : solv->updatemap.size ? 0 : 1;
+ for (pass = startpass; pass < 3; )
{
+ int needpass2 = 0;
int passlevel = level;
Id *specialupdaters = solv->specialupdaters;
/* start with installedpos, the position that gave us problems the last time */
@@ -1880,6 +1884,11 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
* the installed package and not replace it with a newer version */
if (!MAPTST(&solv->noupdate, i - installed->start) && (solv->decisionmap[i] < 0 || solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, i - installed->start))))
{
+ if (pass == 1)
+ {
+ needpass2 = 1; /* first do the packages we do not want/need to update */
+ continue;
+ }
if (dq->count)
queue_empty(dq);
/* find update candidates */
@@ -1964,12 +1973,14 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
if (level < origlevel)
break; /* ran into trouble */
/* re-run all passes */
- pass = !solv->updatemap_all && solv->updatemap.size ? 0 : 1;
+ pass = startpass;
continue;
}
/* reset installedpos, advance to next pass */
installedpos = installed->start;
pass++;
+ if (pass == 2 && !needpass2)
+ break;
}
solv->installedpos = installedpos;
return level;

View File

@ -0,0 +1,192 @@
From 4c7ce065280f062c52ae19d75344c49e5f562108 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Feb 2024 14:42:25 +0100
Subject: [PATCH] Move special updaters handling into its own function
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/4c7ce065280f062c52ae19d75344c49e5f562108
---
src/solver.c | 127 ++++++++++++++++++++++++++++-----------------------
1 file changed, 71 insertions(+), 56 deletions(-)
diff --git a/src/solver.c b/src/solver.c
index 0c3333d87..741aa1b2f 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1788,6 +1788,49 @@ prune_to_update_targets(Solver *solv, Id *cp, Queue *q)
queue_truncate(q, j);
}
+static void
+get_special_updaters(Solver *solv, int i, Rule *rr, Queue *dq)
+{
+ Pool *pool = solv->pool;
+ Repo *installed = solv->installed;
+ int specoff = solv->specialupdaters[i - installed->start];
+ int j, d;
+ Id p;
+
+ /* special multiversion handling, make sure best version is chosen */
+ if (rr->p == i && solv->decisionmap[i] >= 0)
+ queue_push(dq, i);
+ for (d = specoff; (p = pool->whatprovidesdata[d]) != 0; d++)
+ if (solv->decisionmap[p] >= 0)
+ queue_push(dq, p);
+ /* if we have installed packages try to find identical ones to get
+ * repo priorities. see issue #343 */
+ for (j = 0; j < dq->count; j++)
+ {
+ Id p2 = dq->elements[j];
+ if (pool->solvables[p2].repo != installed)
+ continue;
+ for (d = specoff; (p = pool->whatprovidesdata[d]) != 0; d++)
+ {
+ if (solv->decisionmap[p] >= 0 || pool->solvables[p].repo == installed)
+ continue;
+ if (solvable_identical(pool->solvables + p, pool->solvables + p2))
+ queue_push(dq, p); /* identical to installed, put it on the list so we have a repo prio */
+ }
+ }
+ if (dq->count && solv->update_targets && solv->update_targets->elements[i - installed->start])
+ prune_to_update_targets(solv, solv->update_targets->elements + solv->update_targets->elements[i - installed->start], dq);
+ if (dq->count)
+ {
+ policy_filter_unwanted(solv, dq, POLICY_MODE_CHOOSE);
+ p = dq->elements[0];
+ if (p != i && solv->decisionmap[p] == 0)
+ dq->count = 1;
+ else
+ dq->count = 0;
+ }
+}
+
static int
resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
{
@@ -1804,7 +1847,7 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
installedpos = installed->start;
/* we use two passes if we need to update packages
* to create a better user experience */
- for (pass = solv->updatemap.size ? 0 : 1; pass < 2; )
+ for (pass = !solv->updatemap_all && solv->updatemap.size ? 0 : 1; pass < 2; )
{
int passlevel = level;
Id *specialupdaters = solv->specialupdaters;
@@ -1812,7 +1855,6 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
for (i = installedpos, n = installed->start; n < installed->end; i++, n++)
{
Rule *r, *rr;
- Id d;
if (i == installed->end)
i = installed->start;
@@ -1836,48 +1878,20 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
/* check if we should update this package to the latest version
* noupdate is set for erase jobs, in that case we want to deinstall
* the installed package and not replace it with a newer version */
- if (dq->count)
- queue_empty(dq);
if (!MAPTST(&solv->noupdate, i - installed->start) && (solv->decisionmap[i] < 0 || solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, i - installed->start))))
{
- if (specialupdaters && (d = specialupdaters[i - installed->start]) != 0)
+ if (dq->count)
+ queue_empty(dq);
+ /* find update candidates */
+ if (specialupdaters && specialupdaters[i - installed->start] != 0)
{
- int j;
- /* special multiversion handling, make sure best version is chosen */
- if (rr->p == i && solv->decisionmap[i] >= 0)
- queue_push(dq, i);
- while ((p = pool->whatprovidesdata[d++]) != 0)
- if (solv->decisionmap[p] >= 0)
- queue_push(dq, p);
- for (j = 0; j < dq->count; j++)
- {
- Id p2 = dq->elements[j];
- if (pool->solvables[p2].repo != installed)
- continue;
- d = specialupdaters[i - installed->start];
- while ((p = pool->whatprovidesdata[d++]) != 0)
- {
- if (solv->decisionmap[p] >= 0 || pool->solvables[p].repo == installed)
- continue;
- if (solvable_identical(pool->solvables + p, pool->solvables + p2))
- queue_push(dq, p); /* identical to installed, put it on the list so we have a repo prio */
- }
- }
- if (dq->count && solv->update_targets && solv->update_targets->elements[i - installed->start])
- prune_to_update_targets(solv, solv->update_targets->elements + solv->update_targets->elements[i - installed->start], dq);
+ get_special_updaters(solv, i, rr, dq);
+ /* if we have an update set rr to the feature rule */
if (dq->count)
{
- policy_filter_unwanted(solv, dq, POLICY_MODE_CHOOSE);
- p = dq->elements[0];
- if (p != i && solv->decisionmap[p] == 0)
- {
- rr = solv->rules + solv->featurerules + (i - solv->installed->start);
- if (!rr->p) /* update rule == feature rule? */
- rr = rr - solv->featurerules + solv->updaterules;
- dq->count = 1;
- }
- else
- dq->count = 0;
+ rr = solv->rules + solv->featurerules + (i - solv->installed->start);
+ if (!rr->p) /* update rule == feature rule? */
+ rr = rr - solv->featurerules + solv->updaterules;
}
}
else
@@ -1894,24 +1908,25 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
queue_push(dq, p);
}
}
- }
- if (dq->count && solv->update_targets && solv->update_targets->elements[i - installed->start])
- prune_to_update_targets(solv, solv->update_targets->elements + solv->update_targets->elements[i - installed->start], dq);
- /* install best version */
- if (dq->count)
- {
- olevel = level;
- level = selectandinstall(solv, level, dq, disablerules, rr - solv->rules, SOLVER_REASON_UPDATE_INSTALLED);
- if (level <= olevel)
+ if (dq->count && solv->update_targets && solv->update_targets->elements[i - installed->start])
+ prune_to_update_targets(solv, solv->update_targets->elements + solv->update_targets->elements[i - installed->start], dq);
+ /* install best version */
+ if (dq->count)
{
- if (level < passlevel)
- break; /* trouble */
- if (level < olevel)
- n = installed->start; /* redo all */
- i--;
- n--;
- continue;
+ olevel = level;
+ level = selectandinstall(solv, level, dq, disablerules, rr - solv->rules, SOLVER_REASON_UPDATE_INSTALLED);
+ if (level <= olevel)
+ {
+ if (level < passlevel)
+ break; /* trouble */
+ if (level < olevel)
+ n = installed->start; /* redo all */
+ i--;
+ n--;
+ continue;
+ }
}
+ /* check original package even if we installed an update */
}
/* if still undecided keep package */
if (solv->decisionmap[i] == 0)
@@ -1949,7 +1964,7 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
if (level < origlevel)
break; /* ran into trouble */
/* re-run all passes */
- pass = solv->updatemap.size ? 0 : 1;
+ pass = !solv->updatemap_all && solv->updatemap.size ? 0 : 1;
continue;
}
/* reset installedpos, advance to next pass */

View File

@ -0,0 +1,30 @@
From dd6e977782816e330a8f60cf78ca3d12fead3b10 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun, 14 Aug 2022 18:45:20 +0100
Subject: [PATCH] Ensure duplinvolvedmap_all is reset when a solver is reused
Otherwise, if solver is used with a SOLVER_DISTUPGRADE job, then reused
without one, this will cause solver_addduprules() to be called, even
though needduprules is 0, which will crash trying to dereference
solv->dupmap, which is NULL because solver_createdupmaps() hasn't been
called.
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/dd6e977782816e330a8f60cf78ca3d12fead3b10
---
src/solver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/solver.c b/src/solver.c
index 28341d6d3..e3779e232 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -3533,6 +3533,7 @@ solver_solve(Solver *solv, Queue *job)
map_zerosize(&solv->bestupdatemap);
solv->fixmap_all = 0;
map_zerosize(&solv->fixmap);
+ solv->dupinvolvedmap_all = 0;
map_zerosize(&solv->dupmap);
map_zerosize(&solv->dupinvolvedmap);
solv->process_orphans = 0;

View File

@ -0,0 +1,32 @@
From 553c69b514c1ca85a6311373b48c6096886dcff3 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Feb 2024 12:43:50 +0100
Subject: [PATCH] resolve_installed: remove dead code
Since we simplified our dup handling the update rules always
start with the installed package.
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/553c69b514c1ca85a6311373b48c6096886dcff3
---
src/solver.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/solver.c b/src/solver.c
index 363d88734..0c3333d87 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1835,11 +1835,10 @@ resolve_installed(Solver *solv, int level, int disablerules, Queue *dq)
/* check if we should update this package to the latest version
* noupdate is set for erase jobs, in that case we want to deinstall
- * the installed package and not replace it with a newer version
- * rr->p != i is for dup jobs where the installed package cannot be kept */
+ * the installed package and not replace it with a newer version */
if (dq->count)
queue_empty(dq);
- if (!MAPTST(&solv->noupdate, i - installed->start) && (solv->decisionmap[i] < 0 || solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, i - installed->start)) || (rr->p && rr->p != i)))
+ if (!MAPTST(&solv->noupdate, i - installed->start) && (solv->decisionmap[i] < 0 || solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, i - installed->start))))
{
if (specialupdaters && (d = specialupdaters[i - installed->start]) != 0)
{

View File

@ -15,17 +15,30 @@
Name: libsolv
Version: 0.7.14
Release: 3
Release: 8
Summary: Package dependency solver
License: BSD
URL: https://github.com/openSUSE/libsolv
Source: https://github.com/openSUSE/libsolv/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: CVE-2021-3200.patch
Patch0: Fix-memory-leaks.patch
Patch1: Fix-segfault-in-resolve_jobrules.patch
Patch2: Fix-Memory-leaks-in-SWIG-generated-code-for-Python.patch
Patch3: use-memmove-for-overlapping-regions.patch
#fix CVE-2021-3200,CVE-2021-44568,CVE-2021-44569,CVE-2021-44571,CVE-2021-44573,CVE-2021-44574,CVE-2021-44575,CVE-2021-44576,CVE-2021-44577,CVE-2021-33938,CVE-2021-33929,CVE-2021-33928,CVE-2021-33930
Patch6000: backport-testcase-read.patch
Patch6001: backport-Fix-memory-leak-when-using-testsolv-to-execute-cases.patch
Patch6002: backport-Fix-segfault-on-conflict-resolution-when-using-bindings.patch
Patch6003: backport-ensure-duplinvolvedmap_all-is-reset.patch
Patch6004: backport-resolve_installed-remove-dead-code.patch
Patch6005: backport-Move-special-updaters-handling-into-its-own-function.patch
Patch6006: backport-Handle-installed-packages-in-three-passes.patch
Patch6007: backport-Fix-a-couple-small-static-analysis-findings-for-uninitialized-structs.patch
BuildRequires: cmake gcc-c++ ninja-build pkgconfig(rpm) zlib-devel
BuildRequires: libxml2-devel xz-devel bzip2-devel libzstd-devel
Requires: %{_bindir}/find %{_bindir}/curl %{_bindir}/gpg2 %{name}-help
Requires: %{_bindir}/find %{_bindir}/curl %{_bindir}/gpg2
Provides: libsolv-tools libsolv-demo
Obsoletes: libsolv-tools < %{version}-%{release}
Obsoletes: libsolv-demo < %{version}-%{release}
@ -189,6 +202,33 @@ Python 3 version.
%{_mandir}/man3/%{name}*.3*
%changelog
* Tue Jul 16 2024 LuWu <2398491106@qq.com> - 0.7.14-8
- Handle installed packages in three passes
* Tue Oct 20 2022 hanhuihui <hanhuihui5@huawei.com> - 0.7.14-7
- SUG:NA
- DESC:fix memory leak, bindings error, crash error
* Thu Mar 03 2022 xingxing <xingxing9@h-partners.com> - 0.7.14-6
- Type:cves
- CVE:CVE-2021-3200-CVE-2021-44568-CVE-2021-44569-CVE-2021-44571-CVE-2021-44573-CVE-2021-44574-CVE-2021-44575-CVE-20
21-44576-CVE-2021-44577
- SUG:NA
- DESC:fix CVE-2021-3200-CVE-2021-44568-CVE-2021-44569-CVE-2021-44571-CVE-2021-44573-CVE-2021-44574-CVE-2021-44575-C
VE-2021-44576-CVE-2021-44577
* Tue Nov 02 2021 quanhongfei <quanhongfei@huawei.com> - 0.7.14-5
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:backport patches
* Tue Aur 3 2021 Jianmin <jianmin@iscas.ac.cn> - 0.7.14-4
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:remove libsolv-help dependency
* Fri May 28 2021 gaihuiying <gaihuiying1@huawei.com> - 0.7.14-3
- Type:cves
- CVE:CVE-2021-3200

View File

@ -0,0 +1,25 @@
From ccc2ec885a81de137c30fd0deb8c5475440e5287 Mon Sep 17 00:00:00 2001
From: Wolf Vollprecht <w.vollprecht@gmail.com>
Date: Thu, 8 Jul 2021 09:13:19 +0200
Subject: [PATCH] use memmove for overlapping regions
Conflict:NA
Reference:https://github.com/openSUSE/libsolv/commit/ccc2ec885a81de137c30fd0deb8c5475440e5287.patch
---
src/conda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conda.c b/src/conda.c
index 21ad6bfb..6f6a65a6 100644
--- a/src/conda.c
+++ b/src/conda.c
@@ -670,7 +670,7 @@ pool_conda_matchspec(Pool *pool, const char *name)
if (build)
{
*p++ = ' ';
- memcpy(p, build, buildend - build);
+ memmove(p, build, buildend - build);
p += buildend - build;
}
evrid = pool_strn2id(pool, version, p - version, 1);