Jon Turney [Sun, 14 Aug 2022 17:45:20 +0000 (18:45 +0100)]
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.
New strategy: take the package update map into account when creating
choice rules. This simplifies the code quite a bit. Also check at
the end of the solving if a choice rule led to two packages providing
the same thing. In that case, break the choice rule and re-run the
solver.
Userdata can be arbritrary (binary)data with a maximum size of
65535 bytes. It can be read without reading the complete
solv file, but do not forget to rewind the fp after reading
the user data.
New functions:
void
void repowriter_set_userdata(Repowriter *writer, const void *data, int len)
int solv_read_userdata(FILE *fp, unsigned char **datap, int *lenp)
niner [Tue, 8 Feb 2022 17:10:54 +0000 (18:10 +0100)]
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.
Try to keep packages from a cycle close togther in the transaction order
If there are multiple free-to-install packages and we pick a
package from a cycle, we should try to finish the cycle as
fast as possible to keep the time where we have an inconsistent
system as small as possible.
Lukáš Hrázký [Fri, 15 Oct 2021 13:51:19 +0000 (15:51 +0200)]
Add an ifdef allowing to rename Solvable dependency members
In C++20 "requires" is a new keyword, causing a conflict with the
Solvable::requires attribute. From the outside this can only be fixed
with an ugly preprocessor redefinition of the symbol around each libsolv
header include.
This commit adds an #ifdef allowing to rename the dep attributes in case
C++20 or higher is used, which can be easily defined in one place in the
libolv user's build system.
- add flag to bindings
- support flag/ruletype in testcases
- support strict repo prio problems in solution generation
- implement automatic disabling of strict repo rules due to install jobs
- add a testcase
For some reason libxml2 insists on re-escaping '&' characters
by substituting them with "&". The rpm dependencies are
stored in attributes, so this is not an academic matter.
Undo the damage done by libxml2 by replacing all & occurences
by a single '&'.
Jaroslav Rohel [Tue, 30 Mar 2021 06:42:31 +0000 (08:42 +0200)]
Fix: zchunkopen: resources leaks, don't close supplied fd
System variant:
- resource leaks when `zck_init_read` or `zck_init_write` fails
- supplied fd will be closed if `zck_create` fails
Libsolv limited zchunk implementation:
- resource leak when `strcmp(mode, "r") != 0`
- supplied fd will be closed if `solv_zchunk_open` fails (Fix is thread
unsafe. However the original version caused a double-close in the caller
function and was thread unsafe too.)
Jaroslav Rohel [Mon, 29 Mar 2021 15:16:54 +0000 (17:16 +0200)]
Fix: lzopen and zstdopen: don't close supplied fd
In the case of failure of some functions, the `fp` file stream has been
closed. And the stream closed the associated supplied `fd` file descriptor.
The caller then closed the closed descriptor again (eg `curlfopen` in
`repoinfo_download.c`: `if (!Fp) close (fd);`) -> double_close.
In multithreaded software risk of race conditions. Another thread open
another file and reuse just closed file descriptor. The caller
then closes the file of another thread.
Thomas Lam [Tue, 30 Mar 2021 12:33:52 +0000 (05:33 -0700)]
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
testcase_read: error out if repos are added or the system is changed too late
We must not add new solvables after the considered map was created, the solver
was created, or jobs were added. We may not changed the system after jobs have
been added.
(Jobs may point inside the whatproviedes array, so we must not invalidate this
area.)