summaryrefslogtreecommitdiff
path: root/src/database.c
AgeCommit message (Collapse)AuthorFilesLines
2023-05-03db: always generate reverse dependency cacheTimo Teräs1-2/+2
Fixes commit d5ff6c96 "support --from=FROMSPEC". The condition to generate the reverse dependencies changed causing it not to be always generated. Fix this by unconditionally generating it. fixes #10896
2023-04-26db: fix apk_db_foreach_matching_name to match all without argsTimo Teräs1-2/+2
This is a fixup to the backport commit 67f5a753: db, apps: sort display results based on package names This makes apk_db_foreach_matching_name() act consistently on between 2.14-stable and master. And updates the call sites where differing behaviour is needed, and fixes dot and other call sites to work again. fixes #10893
2023-04-17db: suppress warning about missing checksum for special filesTimo Teräs1-1/+15
fixes #10889
2023-04-12db, index: clean up index writing error handlingTimo Teräs1-3/+1
2023-04-12use fstatat, not fstatat64Ariadne Conill1-3/+3
the stat64 family of functions were provided as transitional functions, but when building on glibc with _GNU_SOURCE, or any other supported system, the stat functions are equivalent to their stat64 counterparts
2023-04-12db, index: refactor index writingTimo Teräs1-45/+3
2023-04-11apk: add --force-missing-repositoriestt-stable-wipTimo Teräs1-0/+9
2023-04-11audit: add a new --full modeTimo Teräs1-5/+5
2023-04-11audit: add --protected-paths to override the audit exceptionsTimo Teräs1-4/+8
2023-04-11io: make apk_blob_from_* return errorTimo Teräs1-10/+7
2023-04-11db, dot, fetch, info, list, search: support --from=FROMSPECTimo Teräs1-1/+3
Allow omitting loading of system installed database and system repositories for the commands that operate on package indexes only.
2023-04-11db, info: sort installed package based data by package nameTimo Teräs1-6/+29
2023-04-11db: case insensitive searchesTimo Teräs1-1/+1
fixes #10871
2023-04-11db, apps: sort packages by pkgname and pkgverTimo Teräs1-18/+118
This will also fix "search" to display one match from each principal pkgname group. "search -e vim" will now show both vim and gvim. fixes #10864 fixes #10777
2023-04-11db, apps: sort display results based on package namesTimo Teräs1-30/+107
2023-04-10cache: fix handling of explict cache at static cache locationTimo Teräs1-3/+11
Omit separate static cache handling step if the explicit cache is configured to the static cache directory. fixes 609fd218 "cache: fix 'clean' to prune static cache always"
2023-04-10cache: fix 'clean' to prune static cache alwaysTimo Teräs1-5/+12
Fix cache applet to prune the static cache which is used for index files if explicit caching is not enabled. fixes #10754
2022-12-28db: handle repository index update/opening errors more consistentlyTimo Teräs1-25/+34
Track separately autoupdate failure, and opening errors. And print only one error per index at maximum. This makes update with or without --no-cache consistent. Ignore errors from local paths as builders often refer to a local path that is being built, but might be non-existent when building the first package. ref #10726
2022-12-20db: simplify reverse name list creationTimo Teräs1-12/+12
2022-06-03db: fix atfd for access repository indexTimo Teräs1-2/+3
fixes #10834
2022-01-17package: fail on invalid control dataTimo Teräs1-2/+4
Handle meta data error to produce hard failure. fixes #10806
2021-12-14everywhere: use stdlib.h for malloc(3) definition, not GNU-specific malloc.hAriadne Conill1-1/+0
musl implements support for malloc.h, but it is only a stub. we do not use any of the GNU-specific malloc interfaces, so just use POSIX stdlib.h instead. ref #10794
2021-12-14fix fetching of depdencies only packagesTimo Teräs1-14/+9
Remove the APK_REPOSITORY_CACHED bit from dependencies only packages (that is, installed_size == 0). For fetch, the problem is that apk_db_select_repo() would return the cache repository, but the package would not be there. Update also the locations needed to handle these packages correctly without the cached repository bit being set.
2021-11-12db: purge temporary files without explicit modification checkTimo Teräs1-1/+2
When extraction failed, the user has had no opportunity to edit any files. Just clean up.
2021-08-23db: honor SOURCE_DATE_EPOCH for scriptdbTimo Teräs1-2/+0
fixes #10762
2021-07-26db: fix installed db writing with long namesSamanta Navarro1-6/+11
Packages containing files with path names longer than 1024 characters cannot fit into the buffer which is used to write "installed" database. This leads to bbuf being APK_BLOB_NULL in apk_db_write_fdb because apk_blob_push_blob notices the condition and correctly handles it. The problem occurs when arguments to apk_ostream_write are manually calculated by pointer arithmetics. Since bbuf.ptr is NULL in such a case, bbuf.ptr - buf leads to a huge size value while buf still points into the stack. fixes #10751 [TT: minor edit to commit and abbreviating the commit message]
2021-07-23db: allow read-only operations without cacheTimo Teräs1-11/+9
fixes #10748
2021-07-23db: check syscall errors in update_permissions()Timo Teräs1-5/+17
2021-03-19database: do not chroot(".") unless actually necessaryAriadne Conill1-2/+13
If we use default root (/), then we do not have to chroot to run scripts. Use APK_NO_CHROOT flag for this scenario to avoid the chroot. This helps with using apk with bwrap and OSTree. Closes #10736. [TT: backported to 2.12-stable]
2021-02-07db: fix control character check to use uint8_tTimo Teräs1-2/+2
fixes #10737
2021-02-07db: consider control characters in filename as maliciousTimo Teräs1-11/+19
Especially a newline can produce havoc in the database file as the filename is written there as-is. This hardenes the extraction to consider any control character as malicious. Additional hardening is added to database loading to better detect corrupt state and return proper error code about it. Reported-by: Luca Weiss <luca@z3ntu.xyz>
2021-01-14database.c: Fixed package DESCRIPTION parsingthibault.ferrante1-0/+1
Regression introduced by 0fb0d30 which makes parsing a description a critical failure. [TT: Minor stylistic change. Fix also missing final line change from the earlier commit]
2021-01-11database: Propagate errors when loading an APKINDEXthibault.ferrante1-6/+7
In case of failure when loading an APKINDEX, no errors are propagated to the user which may uncorrectly interpret the current problem.
2020-10-07various changes to make clang not give warningsTimo Teräs1-4/+4
2020-10-06db: make the --repositories-file change more announcedTimo Teräs1-3/+7
Document the version when changed. And print error with similar note if the given repositories-file cannot be read.
2020-10-06database: automatically create missing cache dirPaul Spooren1-0/+6
On some systems the `/var/` dir is mounted in a tmpfs which is reseted after each reboot. For that reason no post-install script can handle the creation of the cache dir at `/var/cache/apk`. Check on database opnening if the folder is available, if not create it. Fixes #10715 Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-10-05db: make --repositories-file relative to host rootTimo Teräs1-1/+1
It used to be relative to the --root specified root, but that causes issues with relative command line filenames and is unintuitive. Update documentation accordingly. Fixes #10702.
2020-10-05db: mask password component of printed URLsTimo Teräs1-12/+19
fixes #10710
2020-10-01db: check cache only if some repositories are enabledTimo Teräs1-1/+1
2020-08-29database: clarify the deprecation notice for checksum-less packagesAriadne Conill1-3/+7
Closes #10708.
2020-05-27database: create additional device nodes when initializing root fsAriadne Conill1-0/+4
Some triggers and maintainer scripts depend on /dev/random, /dev/urandom, /dev/zero and /dev/console.
2020-05-19make the atom functions not use global stateTimo Teräs1-17/+19
This greatly helps with memory management on applications that may want to daemonize and open/close database several times. Also the lifetime and "owner" of memory for all data is now explicitly bound to owning struct apk_database, which might be helpful when writing language bindings. As side effect, the interned "atoms" are unique only within what apk_database, so comparing packages from different apk_database may not work as expected. Fixes #10697
2020-05-07use SPDX-License-Identifier in source filesTBK1-3/+1
2020-04-28apk: do not manage file ownership as non-root or when asked soFredrik Gustafsson1-1/+5
If apk is run as a non-root user, it's not possible to chown files. Maintainers note: minor wording changes on commit log and man page. Signed-off-by: Fredrik Gustafsson <fredrigu@axis.com>
2020-04-01db: fix database reading without scripts or triggersTimo Teräs1-6/+10
Most notably this happens after blank database is initialized with --initdb, but can happen also in other conditions. The error checking changes modified behaviour if the file does not exist. Explicitly check for ENOENT and ignore it. But the behaviour is improved from earlier as now e.g. EPERM will be detected and reported correctly. Fixes #10679 Fixes: 6da3e8eb15 "istream, archive, db: convert db and tar function to use istream"
2020-02-21db: fix unaligned memory access in csum_hash()Timo Teräs1-1/+3
2020-02-14io: add stream copy helperTimo Teräs1-1/+1
2020-02-04remove apk_time() as it is causing problems with shared objectsTimo Teräs1-2/+2
Instead, to make sure test mode produces same output, redefine time() for the test mode binary. Reverts parts of 0b82bcc53e60.
2020-01-25document mysterious SHA-1 blob in database.cReid Rankin1-0/+2
2020-01-24db: additional clean up and hardening for apk extractionTimo Teräs1-15/+16
This enforces all scripts to be in the control block, and all data files to be in data block. Ignoring of dot files in root is added back: packages without any real files will ship one ".dummy" item in the data block to trigger processing and validation to work.