Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
AgeCommit message (Collapse)Author
2021-03-01Update copyright yearAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09libalpm: const annotate struct db_operationsEmil Velikov
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2021-01-09libalpm: const annotate struct pkg_operationsEmil Velikov
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13Use GOTO_ERR throughoutAllan McRae
The GOTO_ERR define was added in commit 80ae8014 for use in future commits. There are plenty of places in the code base it can be used, so convert them. Signed-off-by: Allan McRae <allan@archlinux.org>
2020-04-13Add REALLOC macro to simplify realloc error handlingRikard Falkeborn
realloc can fail just like the other memory allocation functions. Add a macro to simplify handling of realloc failures, similar to the already existing MALLOC, CALLOC, etc. Replace the existing realloc uses with the new macro, allowing us to move tedious error handling to the macro. Also, in be_package and be_sync, this fixes hypothetical memory leaks (and thereafter null pointer dereferences) in case realloc fails to shrink the allocated memory. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2020-02-10build-aux/update-copyright 2019 2020Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2020-01-07Use c99 struct initialization to avoid memset callsDave Reisner
This is guaranteed less error prone than calling memset and hoping the human gets the argument order correct.
2019-11-26Fix documentation of alpm_mtree_next and remove libarchive exposureAllan McRae
The documentation of the return types of alpm_mtree_next was incorrect. This extended into the relevant function in be_local.c. Also, return explicit integer values, rather than the ARCHIVE_xxx values, to avoid unnecessarily exposing frontends to libarchive internals (even though it makes no functional difference). Original-work-by: morganamilo <morganamilo@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2019-10-23Update copyright yearsAllan McRae
make update-copyright OLD=2018 NEW=2019 Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10be_local.c: remove aligment in local_pkg_opsAllan McRae
The alignment was not overly helpful and caused unnecessary churn when a new value with longer name was added. Signed-off-by: Allan McRae <allan@archlinux.org>
2019-01-10libalpm: parse {check, make}depends when reading databasemorganamilo
Commit 0994893b0e6b627d45a63884ac01af7d0967eff2 added the alpm_pkg_get_{make,check}depends functions but forgot to include logic for parsing these fields from the database. As a result these functions will always return an empty list. This commit adds the parsing logic. Signed-off-by: morganamilo <morganamilo@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-05-14Remove all modelines from the projectEli Schwartz
Many of these are pointless (e.g. there is no need to explicitly turn on spellchecking and language dictionaries for the manpages by default). The only useful modelines are the ones enforcing the project coding standards for indentation style (and "maybe" filetype/syntax, but everything except the asciidoc manpages and makepkg.conf is already autodetected), and indent style can be applied more easily with .editorconfig Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2018-03-14Update coyrights for 2018Allan McRae
make update-copyright OLD=2017 NEW=201 Signed-off-by: Allan McRae <allan@archlinux.org>
2018-01-10detect pkghash allocation failureAndrew Gregory
If rehash ever failed with a full hash it would return the old hash that is already full. get_hash_position would then loop forever because it would never find an empty bucket. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04add _alpm_filelist_sortAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2017-01-04Update copyright yearsAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2016-12-05be_local: remove unused error returnAndrew Gregory
LAZY_LOAD has completely ignored the errret value since commit 307a6de17a3bca9f8666b33aa3fb9a8dd88c300b in 2011. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-10-22Represent bitfields as ints, not enumsIvy Foster
Many bitfield variables are declared to be enums, because they are generated using bitwise operations on enums such. However, their actual values aren't necessary members of their parent enum, so declaring them 'int' is more accurate. Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-25Return boolean from db_populateRikard Falkeborn
Since the number of packages is not used anywhere, just return a boolean to avoid the implicit cast from size_t to int in be_local.c. Use 0 as success to be consistent with db_validate. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-09-20Fix gcc strict-overflow errorRikard Falkeborn
Recent gcc (tested with 6.2.1) produces the following error when compiling with both --enable-warningflags and --enable-debug. In particular, it seems it is the combination of GCC_STACK_PROTECT_LIB and -Wstrict-overflow=5 produces the error. be_local.c:609:4: error: assuming signed overflow does not occur when simplifying conditional [-Werror=strict-overflow] if(count > 0) { Fix this by changing the type of count from int to size_t, which is fine since count is never negative. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-08-30Release resources on error paths.Tobias Stoeckmann
Some resources (memory or file descriptors) are not released on all error paths. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2016-01-04Update copyright years for 2016Allan McRae
make update-copyright OLD=2015 NEW=2016 Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03ensure realloc has a positive sizeAndrew Gregory
If given size 0 POSIX allows realloc to return a pointer that is not suitable for use. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-03-03Abort of failure to add version file to empty local databaseAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-02-01Update copyright notices for 2015Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-01-21Merge branch 'maint'Allan McRae
2015-01-21be_local: fix _alpm_greedy_grow usageDaniel Micay
The files_size variable contains the current capacity (in bytes) and should not be used to calculate the next length increment. It only works because _alpm_greedy_grow currently results in incremental growth. Signed-off-by: Daniel Micay <danielmicay@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-27Remove logically dead code in _alpm_local_db_writeAllan McRae
We can only get to cleanup: through fp being NULL due to fopen failing or normal execution when fclose is called. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24libalpm: Add accessors for the base fieldJohannes Löthberg
This commit adds the necessary accessor functions to get the PKGBASE of a package, forcing the desc file to be parsed. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24libalpm: Parse and write PKGBASEsJohannes Löthberg
This commit adds support to libalpm to parse the pkgbase present in packages .PKGINFO files, writing the PKGBASE to the %BASE% section of the local DBs desc files and for parsing it again when loading the local DB Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-12-24local_db_read: fix memory leak on errorAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_freeFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-09-23wrap fgets to retry on EINTRAndrew Gregory
The read() underlying fgets() can be interrupted by a signal handler causing fgets() to return NULL. Before we started handling SIGWINCH, the odds of interrupting a read were low and typically resulted in termination anyway. Replace all fgets calls with a wrapper that retries in EINTR. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
2014-09-23Check the version of the local database during validationAllan McRae
When we check the database version directly, there is no longer a need to scan for depends files. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23Add version file to empty local databaseAllan McRae
If a user manually creates the local database directory, or has an empty local database for some other reason, we silently add a version file Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23Add version file when creating local database directoryAllan McRae
The version of the local pacman database is stored in its root in the file ALPM_DB_VERSION. The version is starting at 9, corresponding to the next libalpm library version. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-23Create local database directory if it is missingAllan McRae
This means that a missing local database becomes an error (as it should be immediately created). Note this only creates the "local" directory and not its parent, which is checked for during locking. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-08Use MALLOC throughtout libalpmAllan McRae
Use MALLOC instead of malloc for safety in libalpm. Some changes are pure refactoring, but for others this provides a success check for memory allocation. Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03be_local: Use alpm_greedy_growFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2014-01-30local_db_populate: initialize empty pkgcacheAndrew Gregory
If the db directory did not exist when local_db_populate was called, the pkgcache wouldn't be initialized, causing pkghash_add_pkg to fail. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz
Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update comment for local db entry creationAllan McRae
Mention mtree files do not need creation in addtion to install files. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04libalpm: introduce a usage level for reposDave Reisner
This defines a level of interest a user has in a repository. These are described by the bitmask flags in the alpm_db_usage_t enum: ALPM_DB_USAGE_SEARCH: repo is valid for searching ALPM_DB_USAGE_INSTALL: repo is valid for installs (e.g. -S pkg) ALPM_DB_USAGE_UPGRADE: repo is valid for sysupgrades ALPM_DB_USAGE_ALL: all of the above are valid Explicitly listing the contents of a repo will always be valid, and the repo will always be refreshed appropriately on sync operations. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29Restore libarchive 2.8.x compatibilityDan McGee
We still call some of these 'deprecated' methods elsewhere, so this shouldn't present a problem. When we decide 2.x support is to be dropped, we should update all of the code to not call deprecated methods. Allan: Adjusted with respect to previous patches adding libarchive compatibilty layer. Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-29Use libarchive compat header for relevant symbolsDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-01-03Update copyright year for 2013Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add public functions for accessing mtree dataAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Add internal functions for reading mtree file from local dbAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org>
2012-12-14Plug various minor memory leaksAndrew Gregory
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>