aboutsummaryrefslogtreecommitdiff
path: root/libq
Commit message (Collapse)AuthorAgeFilesLines
* libq/Makefile: fix out-of-srcdir buildFabian Groffen2024-06-292-2/+4
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* build-sys: regenFabian Groffen2024-06-281-2/+0
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* *: remove i18n/gettext supportFabian Groffen2024-06-271-17/+0
| | | | | | | | This looked very rudimentary, and half, there were no translations, and not all strings were covered. It was never enabled, so dummy for many releases. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/xarray: Handle NULL arrays in xarraysort()Boris Staletic2024-04-081-2/+3
| | | | | | | | | | | | Some invocations of `q` may try to call `xarraysort(NULL, 0)`. One example is `qlop -a foo` where `foo` was never unmerged. Instead of requiring every call of `xarraysort()` to take care of `NULL` arguments, `xarraysort()` now exits early if `arr->eles == NULL`. Closes: https://github.com/gentoo/portage-utils/pull/28 Signed-off-by: Boris Staletic <boris.staletic@protonmail.com> Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* qlop: Properly handle atom_compar_cb when called from qsortBoris Staletic2024-03-292-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | `qsort` passes pointers to elements ("iterators" in C++ lingo) to the callback, not elements directly. Hence `l` and `r` in `atom_compar_cb` actually receives `depend_atom**`, but only when called from `qsort`. The other two call sites (`tree_pkg_compar` and `pkg_sort_cb`) actually apssed `depend_atom*`. This leads to type casting confusion and undefined behaviour for any invocation of `qlop -p`. First discovered by SEGFAULT-ing with the following invocation: qlop -p `cat /var/lib/portage/world` Valgrind and ASAN made triggering the SEGFAULT easier - any invocation with two or more atoms triggered a NULL dereference. This commit addresses the above problem: 1. Expect that `atom_compar_cb` is actually called with two `depend_atom**`. 2. Make `tree_pkg_compar` and `pkg_sort_cb` comply with the above change, by passing `&al` and `&ar`, instead of `al` and `ar`. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: handle hypothetical fail in tree_pkg_meta_get_intFabian Groffen2024-02-011-0/+6
| | | | | | | When we cannot read all bytes from a file, return an empty string, not partial garbage. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/contents: fix invalid access problem pointed out by valgrindFabian Groffen2024-02-011-0/+4
| | | | | | | | len represents the entire string length, but we start scanning after the line identifier, so substract that size from len, such that we don't start scanning after the end of the input string. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/contents: add variant specifying buffer lengthFabian Groffen2024-01-312-20/+38
| | | | | | | This seems necessary for PR #21, but keep the original code structure largely in-tact. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/hash.h: update copyright for previous commitFabian Groffen2024-01-311-1/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/hash: add hash_string functionFabian Groffen2024-01-312-24/+114
| | | | | | | | | | Alternative to the implementation in PR #21, so as to reuse the same hashing code. We could add the interface to compute multiple hashes from the same string when that's actually necessary. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: fix atom comparison bugPavel Kalugin2024-01-271-1/+9
| | | | | | | | qlop SEGFAULTed when predict on a package without category was called Closes: https://github.com/gentoo/portage-utils/pull/24 Signed-off-by: Pavel Kalugin <pavel@pavelthebest.me> Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regenFabian Groffen2024-01-021-44/+43
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/hash: switch from OpenSSL/custom to gnulib-based hash implsFabian Groffen2024-01-024-897/+37
| | | | | | | | OpenSSL deprecated most (if not all) of the hashes we use from it, and we don't have our own implementations for e.g. SHA512, so switch to gnulib's versions, which makes this all simpler. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* *: remove WHIRLPOOL hash supportFabian Groffen2024-01-013-31/+11
| | | | | | | WHIRLPOOL has not been in use since mid 2017, and its support is bound to be removed from OpenSSL. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* gnulib: updateFabian Groffen2024-01-011-7/+88
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: add commetns on file checks (research for bug #898194)Fabian Groffen2023-04-211-0/+9
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* set: try to silence CoverityFabian Groffen2023-02-071-1/+2
| | | | | | | | Now add_set_value can allocate a new set, Coverity thinks this will actually happen, despite in these cases the input set not being NULL. Help Coverity by adding a redundant if. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* set: ensure NULL is empty behaviour is retained throughoutFabian Groffen2023-02-073-12/+44
| | | | | | | | Not all set functions respected NULL is empty behaviour, changed add_set_value signature to return a set instead so it can conform. Bug: https://bugs.gentoo.org/893424 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: add support IDEPENDFabian Groffen2023-01-302-3/+8
| | | | | Bug: https://bugs.gentoo.org/892533 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* build-sys: regeneratev0.94.2Fabian Groffen2022-08-281-305/+431
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* Remove libtoolDavid Seifert2022-08-281-3/+3
| | | | | | | | | | * Libtool was only used for convenience libraries, which can be done in vanilla Automake. This allows passing `static` in LDFLAGS. Bug: https://bugs.gentoo.org/841898 Signed-off-by: David Seifert <soap@gentoo.org> Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: fix atom_compare for "0" version componentsv0.94.1Fabian Groffen2022-06-151-10/+26
| | | | | Bug: https://bugs.gentoo.org/852197 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* build-sys: update gnulibFabian Groffen2022-05-261-0/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/dep: allow resolving multiple times (e.g. for overlays)Fabian Groffen2022-05-261-1/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/dep: add dep_resolve_tree functionFabian Groffen2022-05-262-33/+56
| | | | | | | allow resolving a dep-specification to atoms found in a tree, e.g. see what would get selected Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: make atom_to_string_r produce BUILD_ID when setFabian Groffen2022-05-201-0/+2
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: support FEATURES=binpkg-multi-instance Packages fileFabian Groffen2022-05-202-6/+21
| | | | | | | | | | Based on the work of genbtc in GitHub PR #16 Add BUILD_ID to atom when parsing and use PATH to get the appropriate location. Closes: https://github.com/gentoo/portage-utils/pull/16 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: allow including BUILDID in atom_formatFabian Groffen2022-05-191-0/+15
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: make atom_compare consider BUILDIDFabian Groffen2022-05-191-5/+13
| | | | | PR: https://github.com/gentoo/portage-utils/pull/16 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom.h: add BUILDID to atom for binpkg-multi-instance supportFabian Groffen2022-05-191-16/+17
| | | | | References: https://github.com/gentoo/portage-utils/pull/16 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/atom: implement strict PMS 3.3 in atom_compareFabian Groffen2022-04-181-34/+215
| | | | | | | | Version comparisons are complex, stick with strict PMS definition for it, so we produce the same results as Portage. Bug: https://bugs.gentoo.org/838856 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/dep: print single nodes on a single lineFabian Groffen2022-04-071-5/+29
| | | | | | | | | | | | | | | condense conditional and use-deps to a single line when there's a single target, e.g.: use? ( cat/pkg ) instead of use? ( cat/pkg ) Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regenerateFabian Groffen2022-04-061-0/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regen, add ALL gnulib files this timeFabian Groffen2022-02-271-371/+508
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regen with older gnulibFabian Groffen2022-02-271-508/+371
| | | | | | | | some weird basename-lgpl problems occur with the newer gnulib snapshot, so stick with older version for now Bug: https://bugs.gentoo.org/834136 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regenFabian Groffen2022-02-271-371/+508
| | | | | Bug: https://bugs.gentoo.org/834136 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/move_file: fix Coverity uninitialised use CID 248870Fabian Groffen2022-02-121-3/+3
| | | | | | | | Coverity correctly deduced here, that if we used cached stat, we didn't use the cache, but a bogus memory struct instead. Ensure we always use a populated stat value. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: fix Coverity uninitialised memory use CID 248874Fabian Groffen2022-02-121-4/+4
| | | | | | | | | | tree_read_file_pms was using buf, which was never initialised after some changes from the past remove entire buf, and use the paths from pkg and cat ctxs in the printfs directly Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: plug leak in tree_match_atomFabian Groffen2022-02-061-0/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/xsystem: cleanup/reuse same codepath, allow passing vectorFabian Groffen2022-02-062-39/+65
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: allocate enough space in tree_clone_metaFabian Groffen2022-02-061-1/+1
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: ensure we free cache.store (for Packages file)Fabian Groffen2022-02-061-1/+3
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/xsystem: avoid using obsolete vfork()Fabian Groffen2022-02-061-2/+3
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/tree: avoid nasty realloc magic on tree_pkg_metaFabian Groffen2021-12-292-101/+116
| | | | | | | | doing reallocs possibly (hight probability) invalidates previously retrieved pointers, which is really nasty to work with, and error prone, so instead allocate incremental slabs where necessary Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/move_file: remove source file when doneFabian Groffen2021-12-261-2/+5
| | | | | | move suggests the source is gone, so make sure it is :) Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regenerateFabian Groffen2021-12-261-16/+28
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/move_file: code to move a file or copy+remove itFabian Groffen2021-12-263-0/+127
| | | | | | | This code originated from qmerge.c, it was adapted to be more generic in a function. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/scandirat: add filter_self_parent funcFabian Groffen2021-12-262-5/+22
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* buildsys: regenerateFabian Groffen2021-12-131-5/+7
| | | | | | | - sendfile() additions to configure.ac - autoupdate for 2.71 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* libq/set: allow array_set to be used with an empty setFabian Groffen2021-12-131-0/+5
| | | | Signed-off-by: Fabian Groffen <grobian@gentoo.org>