summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2016-01-04Do not warn about missing files in NoExtractAllan McRae1-2/+4
The CheckSpace option checks the size of all files in a package being replaced and gives a warning when it can not read the file. However, files in NoExtract are expected to be missing and should not be warned about. Fixes FS#47470. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm: Abort ASAP on failure in pre-transaction hooksOlivier Brunel1-0/+8
There is no need to run any/remaining pre-transaction hooks as soon as a failure has occured, which will lead to aborting the transaction. So if an error occured during the first phase (reading directories/parsing files), or as soon as a hook flagged abort_on_fail does fail, we stop processing them and return. (For post-transaction hooks, all hooks are run regardless since there's no aborting.) Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15alpm-hooks: add Description fieldAllan McRae2-0/+7
The "Description" field allows a hook to provide a some text for frontends to use in describing what the hook is doing. For example: Description = updating info page directory Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Show progress processing hooksAllan McRae2-3/+32
Introduces the ALPM_EVENT_HOOK_RUN_{START,DONE} events that are triggered at the start and end of running an individual hook. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Add ALPM_EVENT_TRANSACTION_{START,DONE} eventsAllan McRae2-0/+9
This provides a way to detect when the processing of package changes starts, allowing pacman to delineate hook output and package installation/removal output. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-15Add events ALPM_EVENT_HOOK_{START,DONE}Olivier Brunel3-9/+33
Add events to let frontends know when hooks are being processed (and when it's done), as that might be useful to update the UI. Signed-off-by: Olivier Brunel <jjk@jjacky.com>
2015-12-15Collect all triggered hooks before running themAllan McRae1-1/+10
Having a first pass that checks which hooks are triggered followed by a second pass of the triggered hooks allows us to only provide output when a hook is actually triggered. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-09Pull translations from Transifex and prepare for next releaseAllan McRae47-4491/+8097
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-06alpm_run_chroot: remove dead codeAndrew Gregory1-5/+0
Removes a leftover error message from when fdopen and fgets were used to read from the pipe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05alpm_initialize: Fix double slash in sys hook dir pathDavid Macek1-2/+5
The path of the default system hook directory was created by concatenating `myhandle->root` (usually "/"), and SYSHOOKDIR (usually "/usr/share/libalpm/hooks/"), resulting in "//usr/share/libalpm/hooks/". Fix this by skipping the initial slash from SYSHOOKDIR. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05db_update: always clear db flags after updateAndrew Gregory1-22/+23
Signature downloading and DB validation was being based on the most recent download status for the DB. If a DB successfully downloaded but a signature did not, db_update would move to the next server. If the next server tried does not have a more recent copy of the DB, db_update would not download the DB again and would forget that the DB had previously been updated. In this case it would skip validation entirely, leaving an updated DB with the original validation status. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05add and expose alpm_unlockAndrew Gregory2-2/+18
alpm_unlock is a limited version of alpm_release that does nothing but the actual unlinking of the lock file and is therefore safe to call from signal handlers. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05handle_unlock: return 0 if lockfile == NULLAndrew Gregory1-1/+1
Returning -1 is useless since we don't provide any way to determine why it failed. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05skip conflicts resolved by file replacementAndrew Gregory1-0/+15
When replacing a file with a directory, any files inside the new directory cannot possibly exist on the filesystem and can be skipped. This allows cross-package symlink-to-directory transitions when there are files with the same name under both the symlinked directory and the new directory. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-05always unlink files before extractionAndrew Gregory1-8/+3
libarchive will not extract a directory over an existing directory symlink, making it impossible to replace a symlink with a directory across packages. Adding the ARCHIVE_EXTRACT_UNLINK and ARCHIVE_EXTRACT_SECURE_SYMLINKS causes libarchive to unlink the existing symlink and prevents it from extracting any paths that contain a symlink, which we should not be doing anyway. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-12-04Add large file support CFLAGS to pkgconfig fileAllan McRae1-1/+1
Large file support is enabled by our configure script as required. If anything linking to libalpm does not also define large file support, there will be differences in the size of off_t which are not caught until runtime. Add the required CFLAGS to the pkg-config file so that users of libalpm know what flags are required. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28run_chroot: always clear script output bufferAndrew Gregory1-0/+6
If the script output does not end in a newline there could still be data in the buffer after the poll loop. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28hooks: pass matched targets to hooksAndrew Gregory1-17/+110
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow specifying input to scriptletsAndrew Gregory4-29/+179
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-28allow arguments in hook Exec fieldsAndrew Gregory1-5/+124
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-11Use correct format specifiersRikard Falkeborn4-4/+4
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-11-03ensure realloc has a positive sizeAndrew Gregory2-6/+14
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-10-28_alpm_hook_run: check path length before copyingAndrew Gregory1-8/+19
If a hook path equals or exceeds PATH_MAX characters the path will be left unterminated. Pre-calculating the path length also allows us to use the more efficient memcpy over strncpy. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27hook.c: print invalid option nameAndrew Gregory1-1/+1
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27order hooks by file nameAndrew Gregory1-0/+8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Alpm, check for NULL in free-functionsRikard Falkeborn6-3/+11
Also, use FREE() instead of free() in _alpm_backup_free() to set the pointers to NULL. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-27Use ARRAYSIZE macro for non-string array size computationPierre Neidhardt1-1/+1
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18validate hooks after parsingAndrew Gregory1-1/+64
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18run hooks during trans_commitAndrew Gregory8-0/+294
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18add hook data types and parserAndrew Gregory2-0/+188
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-10-18handle: add hookdirs optionAndrew Gregory5-0/+75
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-20check fileconflicts and diskspace outside commitAndrew Gregory3-6/+21
This is necessary in order to be able to run PreTransaction hooks as close to the actual commit as possible so that we don't prematurely run hooks for a transaction that ultimately never happens. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-09-19sortbydeps: skip local packages being updatedAndrew Gregory1-3/+8
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08libalpm: Force update when database is marked as corrupted.Sebastian Lackner1-0/+5
When a database and its signature is updated non-atomically on a server, there is a window where a user may update the database but grab the old signature. The database is marked as invalid by libalpm, which can be fixed by forcing a refresh (assuming the server has caught up and the user realizes what has happened) or with a future update of the repo. Work around this by forcing a repository refresh whenever a database is invalid. Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08fill in name_hash for assumeinstalled optionsAndrew Gregory1-0/+2
alpm_depend_t is an exposed data type. Front-ends may opt for alloc'ing one and filling the fields manually, but alpm's _alpm_hash_sdbm is not exposed, making it impossible for them to fill in the name_hash field. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08copy assumeinstalled optionsAndrew Gregory1-2/+9
All other option setters copy their input. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08check assumeinstalled for meaningful modAndrew Gregory1-0/+2
assumeinstalled options are used as provisions for which MOD_EQ and MOD_ANY are the only meaningful settings. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08check dep versions before calling strcmpAndrew Gregory1-1/+12
Fixes a segfault when trying to remove an assumeinstalled option without a version. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-08-08Remove ko_KR translationAllan McRae2-818/+0
The "ko_KR" locale is the same as the "ko" locale. Remove the "ko_KR" variant as it is incomplete and has been superseded by "ko" on transifex. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-20ensure matching database and package versionLevente Polyak1-0/+18
While loading each package ensure that the internal version matches the expected database version to avoid the possibility to circumvent the version check. This issue can be used by an attacker to trick the software into installing an older version. The behavior can be exploited by a man-in-the-middle attack through specially crafted database tarball containing a higher version, yet actually delivering an older and vulnerable version, which was previously shipped. Signed-off-by: Levente Polyak <anthraxx@archlinux.org> Signed-off-by: Remi Gacogne <rgacogne@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15Read file lists from databasesAllan McRae1-2/+36
If a sync database contains a "files" file, the file list will be read. Currently, there is no known demand for the file list to be lazy loaded by any libalpm frontend, so these files are read whenever present. Lazy loading can be implemented when a demand exists. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-15Allow frontends to specify the sync database extensionAllan McRae6-8/+44
This allows frontends to select between the .db and .files databases currently supplied by repo-add or any other compatible database. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-14Do not warn about packages that optionally require a removal when ignoring depsAllan McRae1-1/+3
If a transaction is removing a package while ignoring all dependencies, there should not be any warning about other packages optionally requiring it. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-07-12Do not warn about downgrades when only downloading packageAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12libalpm: Do a sanity check before manipulating final DB URLDavid Macek1-4/+11
The change in commit 9d96bed9d6b57 causes download errors for the .db.sig file in case the final URL for the .db file contains query strings or other unexpected stuff. This commit isn't intended to be a total solution, but it should eliminate the problem in the most obvious cases. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12Fix comment in alpm_db_updateDavid Macek1-1/+1
Fix comment to better explain the magic constant used when allocating a buffer for ".db.sig" URL. Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12alpm_logaction: implement documented return valueAndrew Gregory1-8/+16
"return 0 on success, -1 on error (pm_errno is set accordingly)" Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12alpm_logaction: allow falling back to syslogAndrew Gregory1-1/+1
Even if opening the log file fails, if a user has enabled syslog we may still be able to log to that. Set the error return value and continue instead of bailing out. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12alpm_logaction: check logfile before openingAndrew Gregory1-1/+1
valgrind does not like calling open(NULL, ...). This also makes the return value 0 if logfile has not been set. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2015-05-12merge _alpm_logaction into alpm_logactionAndrew Gregory3-54/+29
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>