summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* trans_commit: restore pm_errno after updating logAndrew Gregory2015-02-01
| | | | | | | | | If the call to alpm_logaction failed it would overwrite pm_errno, leading to error messages unrelated to the actual reason the transaction failed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* fix geometric growth in _alpm_greedy_growDaniel Micay2015-01-21
| | | | | | | | It was allocating the required size rather than the calculated new size, resulting in pathological incremental reallocations. Signed-off-by: Daniel Micay <danielmicay@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* be_local: fix _alpm_greedy_grow usageDaniel Micay2015-01-21
| | | | | | | | | 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>
* fix duplication of package sha256sumAllan McRae2014-12-27
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Use correct mode bits for the log file (0000 -> 0644)Evangelos Foutras2014-12-24
| | | | | | | Following commit 086bbc5 (Use O_CLOEXEC as much as possible when opening files), the log file would be created by pacman with blank permissions. Signed-off-by: Allan McRae <allan@archlinux.org>
* Update translations from transifexAllan McRae2014-12-19
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* remove.c: honor inverted patterns in noupgradeAndrew Gregory2014-12-18
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* add alpm_option_match_noupgradeAndrew Gregory2014-12-18
| | | | | | | For parity with alpm_option_match_noextract. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* version: fix memory leak in early returnDave Reisner2014-11-19
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix translation error and remove empty po filesAllan McRae2014-11-19
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Update po files to send to TransifexAllan McRae2014-11-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Pull translation updates from TransifexAllan McRae2014-11-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Add alpm_option_match_noextractAllan McRae2014-11-18
| | | | | | This is useful for frontends testing whether a file is in NoExtract Signed-off-by: Allan McRae <allan@archlinux.org>
* extract_single_file: fix memory leak in error conditionAllan McRae2014-11-18
| | | | | | The memory assigned to checkfile was leaked in the error condition. Signed-off-by: Allan McRae <allan@archlinux.org>
* _alpm_backup_dup: fix memory leak in error caseAllan McRae2014-11-18
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* Remove logging of NoExtract eventsAllan McRae2014-11-18
| | | | | | | With globbing in NoExtract, these log events can quickly pile up hiding important information from the log. Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix crash when using external downloaderAllan McRae2014-11-17
| | | | | | | | | | Commit 9d96bed9 attempts to use the same effective URL for the db and its signature download. However, this information is not available when we use an external downloader, resulting in a crash. Fall back to the old method when the effective URL is unavailable. Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: mark final_url as constChristian Hesse2014-10-19
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* dload: unlink file on filesize exceeded errorChristian Hesse2014-10-16
| | | | | | | | | | On filesize exceeded error pacman leaves a .part file in cache dir, resulting in this error on next try: error: failed to commit transaction (wrong or NULL argument passed) Errors occurred, no packages were upgraded. Unlink the file on error to avoid this.
* dload: use better error message on exceeded file sizeChristian Hesse2014-10-16
| | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* be_sync: use effective URL for db file signature downloadChristian Hesse2014-10-16
| | | | | | | | | | | If download server is dynamic mirror chances are that db file download and db file signature download are redirected to different mirrors, resulting in invalid signature. This uses effective URL for db file signature download and makes the files always match. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Allan McRae <allan@archlinux.org>
* sync.c: download packages before starting commitAndrew Gregory2014-10-13
| | | | | | | | | | download_files sets the transaction state to STATE_DOWNLOADING. Modifying the state after it has already been set to STATE_COMMITTING created a brief window where SIGINT would fail to interrupt the process and caused interrupted downloads to result in a 'transaction started' message in the log with no matching transaction end. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* alpm: Fix wrong xferred/total sizes when resuming downloadsOlivier Brunel2014-10-02
| | | | | | | | | | | | | | | | | | | | When a package is already partially downloaded in the cache, its download size will only be of what's left to be downloaded. Since pkg->download_size is what's used when calculating the total download size for the totaldl callback, same thing apply. However, the download progress callback was including this initial size, which would thus lead to invalid values (and percentage) used in frontends. That is, the progress bar could e.g. go further than 100% In the case of pacman, there is a sanity check for different historical reason (44a57c89), so before the possible "overflow" was noticed, the total download size/progress reported was wrong. Once caught, the TotalDownload option was ignored and it would use individual file download values as fallback instead. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* _alpm_key_in_keychain: cache known keysAndrew Gregory2014-10-01
| | | | | | Implements FS#38042 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* check_keyring: skip keys known to be missingAndrew Gregory2014-10-01
| | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* remove retry check from signature validationAndrew Gregory2014-10-01
| | | | | | | The retry path was removed by 4ccf16dff589ce9f369d377bb5d3f490bd27c624 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* Add --assume-installed optionFlorian Pritz2014-09-30
| | | | | | This allows to ignore specific dependencies. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_freeFlorian Pritz2014-09-30
| | | | Signed-off-by: Florian Pritz <bluewind@xinu.at>
* deps.c: split _alpm_depcmp into _alpm_depcmp_providesFlorian Pritz2014-09-30
| | | | | | | This allows to reuse the provision checker for a simple list of provisions without a package. Signed-off-by: Florian Pritz <bluewind@xinu.at>
* Revert "Remove log_cb, add ALPM_EVENT_LOG instead"Andrew Gregory2014-09-30
| | | | | | | | | | | | | | | Moving logging to the event callback caused warnings under clang due to non-literal format strings and silenced all log messages when --print was used. This reverts commit cd793c5ab7689cc8cbc18277375b368060e5acfe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Conflicts: lib/libalpm/alpm.h src/pacman/callback.c Signed-off-by: Allan McRae <allan@archlinux.org>
* wrap fgets to retry on EINTRAndrew Gregory2014-09-23
| | | | | | | | | | 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>
* alpm.h: remove outdated pkg_get_backup doxygenAndrew Gregory2014-09-23
| | | | | | | | alpm_pkg_get_backup hasn't returned strings since 54ef162a1a9e27e362732d873f0739bc0a2cf1bf in 2011. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Check the version of the local database during validationAllan McRae2014-09-23
| | | | | | | 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>
* Add version file to empty local databaseAllan McRae2014-09-23
| | | | | | | 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>
* Add version file when creating local database directoryAllan McRae2014-09-23
| | | | | | | | 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>
* Create local database directory if it is missingAllan McRae2014-09-23
| | | | | | | | 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>
* fix improper FREELIST callsAndrew Gregory2014-09-16
| | | | | | | | * conflicts need to be freed with alpm_conflict_free * sync dbs need to be unregistered and are handled by alpm_release Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* Fix loading invalid packageOlivier Brunel2014-08-09
| | | | | | | | | | | | In 5acfa65f when adding a new variable (hit_mtree), the initialization of a variable (config) was dropped, which could lead to loading invalid package files, i.e. files that aren't archive (no metadata loaded) would return a new alpm_pkg_t with everything set to 0/NULL. Depending on the operation/use of the package, this could lead to segfault. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* trans_commit: log beginning and end of transactionAndrew Gregory2014-08-04
| | | | | | | | This makes it clear whether a transaction successfully completed and allows log parsers to group related actions. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* filecache_find_url: dereference the 'filebase' pointerRyo Munakata2014-08-04
| | | | | Signed-off-by: Ryo Munakata <ryomnktml@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* replace strdup with STRDUPAndrew Gregory2014-08-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* handle_unlock: log error when lock file is missingAndrew Gregory2014-08-04
| | | | | | | | | | | Problems due to concurrent running instances of pacman can be difficult to diagnose. Log a warning to make it more obvious that that's what happened, that it's a bad idea, and hopefully encourage people who do things like removing the lock file to run pacman from an install script to at least be courteous enough to put it back when they're done. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* handle_unlock: log lock removal failureAndrew Gregory2014-08-04
| | | | | | | | Rather than have individual callers log failure, just do it directly in _alpm_handle_unlock. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* signing.c: remove useless error checkAndrew Gregory2014-08-04
| | | | | | | | CHECK_ERR checks gpg_err which is a local variable. Calling gpg_op_import_result cannot modify it. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* deps.c: use alpm_list_find_ptrAndrew Gregory2014-08-04
| | | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* dep_graph_init: filter ignored packages by nameAndrew Gregory2014-08-04
| | | | | | | | Ignored packages are from the transaction remove list which consists of duplicated packages so a direct pointer comparison is not appropriate. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* handle: factor out string list option handlingAndrew Gregory2014-08-04
| | | | | | | | | | | Consolidates repeated code and replaces dangerous strdup calls with STRDUP. Also fix a couple variables named "pkg" that refer to file paths. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* sync_prepare: remove useless check for replacersAndrew Gregory2014-08-03
| | | | | | | | Since 017184fa, alpm_sync_sysupgrade will not add both a replacement and a literal upgrade to the transaction. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
* move _alpm_lstat into util-commonAndrew Gregory2014-08-03
| | | | Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
* filelist_intersection: manually compare pathsAndrew Gregory2014-08-03
| | | | | | | | | | | Prevents the need to modify paths, removing strndup as an unchecked point of failure, and lengths only need to be calculated if the paths match. Also removed an old comment regarding directory/symlink compatibility. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>