1
0
mirror of https://github.com/openSUSE/libsolv.git synced 2026-02-05 12:45:46 +01:00

708 Commits

Author SHA1 Message Date
Michael Schroeder
1d0e4eebc3 Merge pull request #603 from cmeerw/funopen-seekfn-arg-type
Remove superfluous cast of NULL pointer
2026-02-03 15:27:31 +01:00
Michael Schroeder
0d5e10ee87 detect_dbpath: also check for /usr/lib/sysimage/rpm
Because it's the right location nowadays. (Should not matter
much, as %_dbpath should be set in most cases.)
2026-02-03 13:06:29 +01:00
Christof Meerwald
443d612fa2 Remove superfluous cast of NULL pointer 2025-12-18 18:54:20 +00:00
Michael Schroeder
56f5ca0d86 tarhead: add a line size limit to catch broken entries
Also write back the allocated line length.
2025-08-05 12:03:15 +02:00
Michael Schroeder
f8a299cd63 repo_apk: move entry size limit to the top of the file 2025-08-05 11:59:35 +02:00
Michael Schroeder
39324fcf28 repo_arch: limit the package entry size 2025-08-05 11:57:14 +02:00
Michael Schroeder
c2ace5ece0 repo_apkv3: move arbitrary limits to the top of the file 2025-08-05 11:24:16 +02:00
Michael Schroeder
c8264f9eb4 repo_apkv3: improve blob length check 2025-08-05 11:14:27 +02:00
Michael Schroeder
5fddfaf465 Fix potential access of freed mem in the genid testcase 2025-07-29 10:02:04 +02:00
Redbeanw44602
7c9611d994 fix compile on mingw-w64. 2025-07-24 13:43:26 +08:00
Michael Schroeder
aba891ef74 repo_autopattern: support creation of obsoletes for product packages
This adds support for provides of the type "product-obsoletes(name)".
We translate this to "Obsoletes: product:<name>" in the generated
product pseudo package.

We need this because people used "Obsoletes: product:name" in the
"release" package, but this is no longer allowed in newer rpm versions.
Besides, the obsoletes is kind of wrong in the "release" package
anyway, it belongs in the generated "product:" package.
2025-07-07 13:31:29 +02:00
Michael Schroeder
b6d4ecaaa4 Support orderwithrequires dependencies in susedata.xml 2025-06-03 13:20:20 +02:00
Michael Schroeder
6eb8741bcc repo parsers: use strtoull instead of atoi to parse the time 2025-06-03 12:45:32 +02:00
AntoinePrv
b69d0a1cd4 add missing headers 2025-04-14 15:11:35 +02:00
Michael Schroeder
181c7fe2b8 Use the truncated sha256 sigtag if there is no header+payload md5
Rpmv6 will no longer have a header+payload digest.
2025-04-10 15:40:59 +02:00
Michael Schroeder
4f34f8890c apk: tweak apk_add_hdrid a bit
Make sure that the checksum starts with 'Q'.
2025-03-20 15:11:19 +01:00
Michael Schroeder
a65b458134 repo_apkv3: be more correct in add_add_idb_pkg
Should not matter because the adb blocks are always fitting
in 30 bits.
2025-03-20 11:04:23 +01:00
Michael Schroeder
fb40d94659 Split off common apk_fillbuf function 2025-03-20 11:03:41 +01:00
Michael Schroeder
5e4ff5461e Fix apkv3 dependency operator handling 2025-01-20 16:49:21 +01:00
Michael Schroeder
1639245a4a Also set SOLVABLE_DOWNLOADSIZE for apkv2 indexes 2025-01-20 16:47:10 +01:00
Michael Schroeder
997a5ad99f Add missing solv_free in the adb_read_adb_blk error case 2025-01-17 14:12:15 +01:00
Michael Schroeder
faef2f421f Fix bit shift in adb_read_blk_header
And also move it to the other file read functions.
2025-01-16 16:40:21 +01:00
Michael Schroeder
fab399d839 Rename APK_ADD_INDEX to APK_ADD_INSTALLED_DB while we can 2025-01-15 11:53:17 +01:00
Michael Schroeder
1ebff91704 Implement apkv3 support 2025-01-15 11:46:24 +01:00
Michael Schroeder
5059a587b6 Allow an empty index file in repo_add_apk_repo 2024-12-18 11:00:35 +01:00
Michael Schroeder
eb73ed0d70 Fix repo_add_arch_repo return type 2024-12-17 12:15:54 +01:00
Michael Schroeder
e423f277a9 Implement decompression in repo_add_apk_repo()
We need this to support apkv3 index files.
2024-12-17 12:15:00 +01:00
Michael Schroeder
38c088a9d1 Add a package/repo parser for apk
You need to configure with ENABLE_APK to get them.

Note that we currently only support the v2 format. We'll add
v3 support if somebody uses it in the future.
2024-11-28 13:52:43 +01:00
Michael Schroeder
fbbf2565c1 Add support for DISTTYPE_APK to the libsolv core
This is mostly the apk version comparison. We also do not add
spaces around the comparison ops for apk and shorten =~ to ~.

This is currenly bould to MULTI_SEMANTICS as we do not have
an "alpine" target yet.
2024-11-28 13:33:08 +01:00
Michael Schroeder
224cab32cb Move tar handling from repo_arch into its own file
We'll need it for apk packages.
2024-11-28 13:08:39 +01:00
Michael Schroeder
381322c07c Fix repo_add_arch_local() declaration 2024-11-25 12:03:29 +01:00
Michael Schroeder
e64cecfa10 Add rpm_query_idarray query function
This is added to query the OrderWithRequires dependencies from
downloaded rpms.

Also refactor query code a bit.
2024-09-16 15:43:45 +02:00
Michael Schroeder
c2959803ee Support orderwithrequires dependencies in testcases 2024-09-16 15:35:17 +02:00
Michael Schroeder
283074a4b5 Support rpm's "orderwithrequires" dependency
Note that the rpmmd parser cannot set it as the xml schema
does not include this type of dependency.
2024-09-12 12:37:09 +02:00
Petr Písař
f31c6de1a7 Fix a possible format overflow in dump_genid()
GCC 14 called with CFLAGS='-O2 -Wformat-overflow' complains:

    /tmp/libsolv/ext/testcase.c: In function ‘dump_genid’:
    /tmp/libsolv/ext/testcase.c:1275:33: warning: ‘: genid ’ directive writing 8 bytes into a region of size between 3 and 12 [-Wformat-overflow=]
     1275 |       sprintf(cntbuf, "genid %2d: genid ", cnt++);
	  |                                 ^~~~~~~~
    /tmp/libsolv/ext/testcase.c:1275:7: note: ‘sprintf’ output between 17 and 26 bytes into a destination of size 20
     1275 |       sprintf(cntbuf, "genid %2d: genid ", cnt++);
	  |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/libsolv/ext/testcase.c:1270:33: warning: ‘: genid ’ directive writing 8 bytes into a region of size between 3 and 12 [-Wformat-overflow=]
     1270 |       sprintf(cntbuf, "genid %2d: genid ", cnt++);
	  |                                 ^~~~~~~~
    /tmp/libsolv/ext/testcase.c:1270:7: note: ‘sprintf’ output between 17 and 26 bytes into a destination of size 20
     1270 |       sprintf(cntbuf, "genid %2d: genid ", cnt++);
	  |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That's indeed a bug: sprintf() writes into a 20-byte array cntbuf. cnt
is int, 32-bit long integer on x86_64 Linux platform. dump_genid()
starts with cnt = 1 and increases. It can go up to 2147483647 decimal
value, then wrap to -2147483648 decimal value.  That's up to 11 bytes
of the integer, plus 14 bytes of a static string, plus 1 byte of
a trailing '\0'. 26 bytes in total.

While it's improbable that cnt would amount that long number in real
life, it's better to be prepared for the worst. Also a benefit is that
static analyzers will be be content.

This patch increases cntbuf[] size to accomodate common 32-bit
ints. (Generic, albeit illegible, expression would be:

    cntbuf[((sizeof(cnt) * 8 - 1) * 3 / 10 + 1 + 1) + 14 + 1];

but I'm not sure that long expression is worth of it.)
2024-07-10 17:35:25 +02:00
Michael Schroeder
8151b3a8b4 Add new SOLVER_FLAG_FOCUS_NEW focus type
First resolve the given jobs, then the dependencies of the
resulting packages ignoreing the ones provided by currently
installed packages. After that resolve all already installed
packages. This is similar to SOLVER_FLAG_FOCUS_BEST but less
aggressive in updating packages.

Fixes issue #549
2024-07-09 13:06:16 +02:00
Michael Schroeder
4e0b43211f Also set errno for unsupported compressions in solv_xfopen_fd() 2024-05-16 15:46:23 +02:00
Michael Schroeder
563c233e5c Fix SHA-224 oid in solv_pgpvrfy 2024-05-16 15:42:10 +02:00
Petr Písař
fee69285c3 Report unsupported compression in solv_xfopen() with errno
If libsolv was built without Zstandard support and "primary.xml.zst"
was passed solv_xfopen(), solv_xfopen() returned 0 without setting
errno. A calling application could not distinguish an unsupported
compression format from other I/O errors.

This patch improves this situation by setting errno variable to an
appropriate value. The value macros are documented in POSIX 2017.
2024-05-15 16:55:55 +02:00
David Cantrell
2c4ee52a94 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.
2024-03-26 12:13:55 -04:00
Michael Schroeder
c1593c930b Get rid of a couple of time_t uses
We are using our 'unsigned long long' numeric data type anyway
later on.
2024-02-06 14:09:15 +01:00
Michael Schroeder
fb6ed7f96c repo_rpmdb.c: Do not use deprecated headerUnload with newer rpm versions
We check the definition of RPM_MASK_TYPE to find out it rpm is
new enough.
2023-11-07 11:54:09 +01:00
Michael Schroeder
d301f84316 Fix evr roundtrip
Remove the "0:" stripping from the evr in testcase_read. Messing
with the evr is not our business, we need to reproduce the data
as faithful as possible.
2023-09-27 17:24:34 +02:00
Michael Schroeder
1f0e7b46f4 Support rich deps in SOLVABLE_PREREQ_IGNOREINST 2023-09-12 13:14:17 +02:00
Michael Schroeder
86717630b7 repo_conda: overwrite the package subdir with the info subdir if there is a conflict
This is what classic conda does, so we also need to do it.
Fixes issue #529
2023-07-21 13:53:46 +02:00
Michael Schroeder
296f854b7a Save memory in repo_updateinfoxml by not interleaving repo_addflexarray calls
Mixing repo_addflexarray calls will make the code moving the arrays
in the idarraydata all the time as it cannot append to the arrays.
So first collect the array contents of the collection flexarray and
then add it in one go.

This is based on pull request #533 by Aleš Matěj <amatej@redhat.com>.
2023-07-20 11:50:00 +02:00
Michael Schroeder
36215192ae Merge pull request #520 from ffontaine/master
Fix build without C++
2023-02-23 10:59:41 +01:00
AntoinePrv
031a6a7590 fix: header extern C and guard 2023-02-15 12:08:49 +01:00
Fabrice Fontaine
5691f58d1f Fix build without C++
Fix the following build failure without C++:

CMake Error at CMakeLists.txt:1 (PROJECT):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

Fixes:
 - http://autobuild.buildroot.org/results/a7f2176d40f156c319754ef5d3b7fd0decfe754f

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2023-02-12 15:27:27 +01:00
Michael Schroeder
be85fd99b2 Make use of solver_alternative2str() in testcases
The downside is that only the first ruleinfo is displayed. We'll
see if we need solver_allalternativeinfos...
2022-12-14 16:58:28 +01:00